• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            最大公約數函數gcd(int a,int b)的構造和ax=b (mod n) 的解

            Problem

            Give you a modular equation ax=b (mod n). Count how many different x (0<=x<n) satisfying the equation.

            Input

            The input may contain several test cases.

            Each test contains a line with three integers a, b and n, each integer is positive and no more than 10^9.

            Input is terminated by EOF.

            Output

            For each test case, output a line containing the number of solutions.

            Sample input

            4 2 6

            Sample output

            2

            #include <stdio.h>
            long a,b,n;
            int gcd(long a,long b){
                
            if(a==0){
                    
            return b;
                }

                
            else
                
            {
                    
            return gcd(b%a,a);
                }

            }

            int main(){
                
            while(scanf("%d %d %d",&a,&b,&n)!=EOF){
                    
            long d=gcd(a,n);
                    
            if(b%d==0)
                        printf(
            "%d\n",d);
                    
            else printf("0\n",d);
                }

                
            return 0;
            }
            posted on 2008-04-08 12:53 zhongguoa 閱讀(1095) 評論(1)  編輯 收藏 引用

            評論

            # re: 最大公約數函數gcd(int a,int b)的構造和ax=b (mod n) 的解[未登錄] 2015-06-25 19:25 xxx  回復  更多評論   

            #include <stdio.h>
            long a,b,n;
            int gcd(long a,long b){
            if(a==0){
            return b;
            }
            else
            {
            return gcd(b%a,a);
            }
            }
            int main(){
            while(scanf("%d %d %d",&a,&b,&n)!=EOF){
            long d=gcd(a,n);
            if(b%d==0)
            printf("%d\n",d);
            else printf("0\n",d);
            }
            return 0;
            }
            日本欧美久久久久免费播放网| 亚洲嫩草影院久久精品| 亚洲国产成人久久精品动漫| 久久九色综合九色99伊人| 97超级碰碰碰久久久久| 久久夜色精品国产噜噜亚洲AV| 一本久久免费视频| 久久精品国产亚洲5555| 国产成人精品综合久久久| yellow中文字幕久久网| 91精品日韩人妻无码久久不卡| 久久久久人妻一区二区三区vr| 欧美久久久久久| 久久这里只有精品首页| 99久久国产宗和精品1上映| 亚洲色大成网站WWW久久九九| 久久精品国产亚洲AV忘忧草18| 97精品依人久久久大香线蕉97| 亚洲欧美伊人久久综合一区二区 | 久久九九久精品国产免费直播| 岛国搬运www久久| 久久中文字幕无码专区| 久久婷婷午色综合夜啪| 亚洲AV成人无码久久精品老人 | 99久久国语露脸精品国产| 亚洲va国产va天堂va久久| 日本精品久久久中文字幕| 欧美久久亚洲精品| 人妻丰满AV无码久久不卡| 88久久精品无码一区二区毛片| 7777精品伊人久久久大香线蕉| 久久精品国产亚洲精品2020| 久久99国产精品久久99果冻传媒| 欧美激情精品久久久久久久九九九| 久久精品人妻中文系列| 色偷偷88888欧美精品久久久| 国产精品xxxx国产喷水亚洲国产精品无码久久一区| 欧美777精品久久久久网| 亚洲精品美女久久久久99小说| 国产一级做a爰片久久毛片| 亚洲国产成人久久综合一区77|