hdu 1005
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1005
思路:找规律题
1 #include<stdio.h> 2 main() 3 { 4 int s[100]; 5 int a,b,n,i; 6 while(scanf("%d%d%d",&a,&b,&n)!=EOF&&(a||b||n)) 7 { 8 s[1]=1; 9 s[2]=1; 10 for(i=3;i<=49;i++) 11 { 12 s[i]=(a*s[i-1]+b*s[i-2])%7; 13 } 14 printf("%d\n",s[n%49]); 15 } 16 return 0; 17 } 18