hdu1005

2018-06-04 10:50:31 浏览数 (2)

//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; }

代码语言:javascript复制
	if(n == 0)
		break;
	else
		printf("%dn", f[n % 49]);
}
return 0;

}

0 人点赞