Create 1005.cpp

pull/45/head
JZFamily 2018-01-05 10:21:48 +08:00 committed by GitHub
parent e11349a42b
commit d1e7d4a77e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

13
HDOJ/1005.cpp Normal file
View File

@ -0,0 +1,13 @@
#include<stdio.h>
int main()
{
int a, b, n, i, arr[48];
while (scanf("%d %d %d", &a, &b, &n), a || b || n){
arr[1] = 1;
arr[2] = 1;
for (i = 3; i<48; i++)
arr[i] = ((a*arr[i - 1] + b*arr[i - 2]) % 7);
printf("%d\n", arr[n % 48]);
}
return 0;
}