您的位置:首页 > 其它

POJ - 1597 英语阅读题..

2012-02-20 10:53 211 查看
这道题通过率也有47%了~~就是题目长了~~以前总是跳过去~~今天仔细来看~~很简单了~~具体的来说题意是给出x,y..问x的倍数%y..能否得到0~y-1的所有数...求一次最大公约数就好了...

还有这题容易PE...注意输出时两个数字都是留10个位置..Good/Bad Choise前面是4个空格...每次输出要空一行空白...

Program:

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<queue>
using namespace std; 
int x,y;
int gcd(int x,int y)
{
      if (y==0) return x;
      return gcd(y,x%y); 
}  
int main()
{
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout); 
      while (~scanf("%d%d",&x,&y))
      {
            if (gcd(x,y)==1)
            {
                 printf("%10d%10d    Good Choice\n\n",x,y);
            }else
            {
                 printf("%10d%10d    Bad Choice\n\n",x,y);
            }
      }      
      return 0;   
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: