标签:ted tom HERE amp bottom numbers sub class using
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 72329 Accepted Submission(s): 33039
//(a+b)%c=(a%c+b%c)%c; #include<iostream> #include<math.h> #include<stdio.h> using namespace std; long long a[10000005]; int main() { long long n; a[0]=7%3,a[1]=11%3; for(int i=2;i<1000005;i++) a[i]=(a[i-1]+a[i-2])%3;//和DP很像 while(cin>>n) { if(a[n]==0) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0; }
标签:ted tom HERE amp bottom numbers sub class using
原文地址:https://www.cnblogs.com/-citywall123/p/9509540.html