标签:out div value name arch source can panel show
传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=1005
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 198316 Accepted Submission(s): 49744
#include<bits/stdc++.h> using namespace std; int main() { int a,b,n; int f[10000]; f[1]=1; f[2]=1; while(~scanf("%d %d %d",&a,&b,&n)) { if(a==0&&b==0&&n==0) break; int i; for(i=3;i<10000;i++) { f[i]=(a*f[i-1]+b*f[i-2])%7; if(f[i]==f[1]&&f[i-1]==1)//两个连续的1出现,表面循环到了一个周期的结束 break; } n=n%(i-2);//周期为i-2 f[0]=f[i-2];//周期结束的那个 printf("%d\n",f[n]); } return 0; }
HDU1005 Number Sequence(找规律,周期是变化的)
标签:out div value name arch source can panel show
原文地址:https://www.cnblogs.com/yinbiao/p/9295863.html