问题最后转化成求两个数的最大公约数,如果为1就YES.
#include <stdio.h> int main(){ int step, mod, t; while(scanf("%d%d", &step, &mod) == 2){ printf("%10d%10d", step, mod); while(mod){ t = step % mod; step = mod; mod = t; } printf(" %s\n\n", step == 1? "Good Choice": "Bad Choice"); } return 0; }
HDOJ1014 Uniform Generator,布布扣,bubuko.com
原文:http://blog.csdn.net/chang_mu/article/details/20987039