#include<iostream>
using namespace std;
#define max 100000000
int f[max];
int main()
{
int a, b;
long long n;
while (cin >> a >> b >> n)
{
if (a == b &&b== n &&n== 0)
break;
f[1] = f[2] =1;
for (long long i = 3; i <= n; ++i)
{
f[i] = (a*f[i - 1] + b*f[n - 2]) % 7;
}
cout << f[n] << endl;
}
return 0;
}
1005 Number Sequence
最新推荐文章于 2021-07-02 15:03:12 发布