HDOJ1014 Uniform Generator

原题链接

问题最后转化成求两个数的最大公约数,如果为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;
}


posted on 2014-03-11 07:59  长木Qiu  阅读(145)  评论(0编辑  收藏  举报