Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求最大公约数, 若是为一 , 就是好的;否则 就是坏的, 至于 求最大公约数, 实在不行, 枚举也可;枚举和求最大公约数都是0ms ; #include <stdio.h> main () { int a, b , i, t ; while (scanf ("%d%d", &a, &b) != -1){ printf ("%10d%10d", a, b) ; t = a <b ? a : b ; for (i = 2; i <= t; i ++ ) if (a % i == 0 && b % i == 0) break ; if (i > t) printf (" Good Choice\n\n") ; else printf (" Bad Choice\n\n") ;} } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator