mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Merge pull request #45 from JZFamily/master
Create 1005.cpp. Thanks to JZFamily~!
This commit is contained in:
commit
7c136d90b0
13
HDOJ/1005.cpp
Normal file
13
HDOJ/1005.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user