<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        CodeforcesRound#282(Div.2)-B.ModularEquations_html/css

        來源:懂視網 責編:小采 時間:2020-11-27 15:59:41
        文檔

        CodeforcesRound#282(Div.2)-B.ModularEquations_html/css

        CodeforcesRound#282(Div.2)-B.ModularEquations_html/css_WEB-ITnose:Modular Equations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Last week, Hamed learned about a new type of equations in his math class called Modular Equa
        推薦度:
        導讀CodeforcesRound#282(Div.2)-B.ModularEquations_html/css_WEB-ITnose:Modular Equations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Last week, Hamed learned about a new type of equations in his math class called Modular Equa

        Modular Equations

        time limit per test

        1 second

        memory limit per test

        256 megabytes

        input

        standard input

        output

        standard output

        Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by . A Modular Equation, as Hamed's teacher described, is an equation of the form in which a and b are two non-negative integers and x is a variable. We call a positive integer x for which asolution of our equation.

        Hamed didn't pay much attention to the class since he was watching a movie. He only managed to understand the definitions of these equations.

        Now he wants to write his math exercises but since he has no idea how to do that, he asked you for help. He has told you all he knows about Modular Equations and asked you to write a program which given two numbers a and b determines how many answers the Modular Equation has.

        Input

        In the only line of the input two space-separated integers a and b (0?≤?a,?b?≤?109) are given.

        Output

        If there is an infinite number of answers to our equation, print "infinity" (without the quotes). Otherwise print the number of solutions of the Modular Equation .

        Sample test(s)

        input

        21 5

        output

        input

        9435152 272

        output

        282

        input

        10 10

        output

        infinity

        Note

        In the first sample the answers of the Modular Equation are 8 and 16 since




        題意:給出a,b,問有多少滿足a % x == b的正整數x存在。


        分析:暴力可解。a % x == b有(a - b) % x == 0,也就是找a - b的因子。前提是:x是正整數,但是要注意需滿足x > b(余數比除數小),當a < b時,此時沒有x滿足條件,輸出0即可;當a == b時,應輸出“infinity”;否則的話,直接暴力找a - b的因子即可。




        AC代碼:

        #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x7fffffffint main(){ #ifdef sxk freopen("in.txt","r",stdin); #endif int a, b, ans; while(scanf("%d%d",&a, &b)!=EOF) { ans = 0; if(a < b) puts("0"); else if(a == b) puts("infinity"); else{ int x; for(x=1; x*x b) ans ++; if((a-b)/x > b) ans ++; } } if((a-b) == x*x && x > b) ans ++; printf("%d\n", ans); } } return 0;}



        Python版:

        a, b = map(int, raw_input().split())if a == b: print 'infinity'elif a < b: print 0else: a -= b i = 1 ans = 0 while i*i <= a: if a % i == 0: if i > b: ans += 1 if a/i > b and i*i != a: ans += 1 i += 1 print ans

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        CodeforcesRound#282(Div.2)-B.ModularEquations_html/css

        CodeforcesRound#282(Div.2)-B.ModularEquations_html/css_WEB-ITnose:Modular Equations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Last week, Hamed learned about a new type of equations in his math class called Modular Equa
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 国产福利电影一区二区三区,免费久久久久久久精 | 日本一道本高清免费| 日本高清色本免费现在观看| 亚洲图片中文字幕| 一级免费黄色毛片| 日本成年免费网站| 亚洲永久无码3D动漫一区| 亚洲中文字幕无码中文| 青柠影视在线观看免费高清| 日本精品人妻无码免费大全| 永久亚洲成a人片777777 | 亚洲国产精品久久久久秋霞小| 中文字幕免费在线观看动作大片| 在线jyzzjyzz免费视频| 亚洲欧洲免费视频| 国产精品九九久久免费视频 | 亚洲成A∨人片在线观看不卡| 亚洲人成网站18禁止| 中文字幕免费在线看线人| 亚洲色精品aⅴ一区区三区| 中国人免费观看高清在线观看二区| 亚洲综合精品香蕉久久网| 久久国产乱子伦精品免费一| 亚洲女同成人AⅤ人片在线观看| 亚洲va成无码人在线观看| 久久久久久国产精品免费免费男同 | **实干一级毛片aa免费| 久久精品国产亚洲沈樵| 1000部免费啪啪十八未年禁止观看| 亚洲AV成人一区二区三区在线看| 99爱视频99爱在线观看免费| 亚洲精品成人无码中文毛片不卡| 一级特黄aaa大片免费看| 久久国产精品亚洲综合| 黄色网站软件app在线观看免费 | 亚洲色自偷自拍另类小说| 亚洲精品在线免费观看视频| 精品亚洲av无码一区二区柚蜜| 天天看片天天爽_免费播放| 国产激情久久久久影院老熟女免费 | 亚洲天堂在线视频|