标签:NPU efault namespace ios cst .com problem body 天都
2 3 4 0
2 2 6
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int a[1005]; 6 int solve(int n){ 7 if(n==1) 8 return 0; 9 else if(n==2) 10 return 2; 11 else if(n==3) 12 return 2; 13 else{ 14 for( int i = 4; i <= n; i++ ) 15 a[i] = (a[i-1]+2*a[i-2])%10000; 16 } 17 return a[n]; 18 } 19 20 int main(){ 21 22 int n; 23 a[1] = 0; 24 a[2] = 2; 25 a[3] = 2; 26 while(cin>>n&&n){ 27 cout<<solve(n)<<endl; 28 } 29 return 0; 30 }
标签:NPU efault namespace ios cst .com problem body 天都
原文地址:https://www.cnblogs.com/geziyu/p/10100377.html