标签:
#include <stdio.h>
#include <iostream>
using namespace std;
int f(int n, int A, int B)
{
if(n==1) return 1;
else if(n==2) return 1;
else
return (A * f(n - 1, A, B) + B * f(n - 2, A, B)) % 7;
}
int main()
{
for(int i=1; i<50; i++)
{
printf("%d ", f(i, 1, 2) );
if(i % 10 ==0)
printf("\n");
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/sober-reflection/p/f7cf44687dab7811867f6bfbccb0cca6.html