hdu1005

时间:2022-05-30
本文章向大家介绍hdu1005,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

//c

//https://github.com/WEIZIBIN/acm/blob/master/hdu1005.c #include <stdio.h> int main() { int i, result, a, b, j; long n; int f[50] = {0}; f[1] = 1; f[2] = 1; while(scanf("%d%d%d", &a, &b, &n) != EOF) { for (j = 3; j < 50; ++j) { f[j] = (a * f[j - 1] + b * f[j - 2]) % 7; if (f[j] == 0 && f[j - 1] == 0) break; }

	if(n == 0)
		break;
	else
		printf("%dn", f[n % 49]);
}
return 0;

}