NYOJ 144 小珂的苦恼

时间:2014-02-13 15:12:26   收藏:0   阅读:297

原题链接

二元一次方程 a*x+b*y=n,n为a,b的最大公约数的整数倍即有解

附ac代码:

#include <stdio.h>

int main(){
	int t, a, b, n, x;
	scanf("%d", &t);
	while(t-- && scanf("%d%d%d", &a, &b, &n)){
		while(b){
			x = a % b;
			a = b;
			b = x;
		}
		if(n % a) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}


原文:http://blog.csdn.net/chang_mu/article/details/19137549

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!