Sunday, February 27, 2011

408 - Uniform Generator


#include<stdio.h>
#include<stdlib.h>
int main()
{
    long int step,mod,a,b,c;
    //freopen("in.txt","r",stdin);
    while(scanf("%ld%ld",&step,&mod)==2)
    {
        if(step<mod){a=step,b=mod;}
        else{a=mod,b=step;}
        while(a)
        {
            c=a;
            a=b%a;
            b=c;
        }
        if(b==1)
            printf("%10ld%10ld    Good Choice\n",step,mod);
        else
            printf("%10ld%10ld    Bad Choice\n",step,mod);
        printf("\n");
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.