HDOJ1014 Uniform Generator
生活随笔
收集整理的這篇文章主要介紹了
HDOJ1014 Uniform Generator
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Problem :?1014 ( Uniform Generator )?????Judge Status :?Accepted
RunId : 7742145????Language : C????Author :?qq1203456195
Code Render Status :?Rendered By HDOJ C Code Render Version 0.01 Beta
依題意可知,只要兩個數的最大公約數為1就ok了~
1 #include <stdio.h> 2 int gcd(int a,int b) 3 { 4 int t,min,max; 5 min=a<b?a:b; 6 max=a<b?b:a; 7 while (t=max%min,t!=0) 8 { 9 max=min; 10 min=t; 11 } 12 return min; 13 } 14 int main() 15 { 16 int a,b,g; 17 while (~scanf("%d%d",&a,&b)) 18 { 19 g=gcd(a,b); 20 printf("%10d%10d ",a,b); 21 if(g>1) 22 printf("Bad Choice\n\n"); 23 else 24 printf("Good Choice\n\n"); 25 } 26 return 0; 27 }?
?
?
?
轉載于:https://www.cnblogs.com/CheeseZH/archive/2013/03/12/2955332.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的HDOJ1014 Uniform Generator的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hibernate的数据过滤查询
- 下一篇: html怎么防止扒站点,扒站工具-扒取站