URAL 1225 Flags
题目:click here
1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int M = 1e5+5; 5 6 int n; 7 ll a[50]; 8 int main() { 9 a[1] = 2; 10 a[2] = 2; 11 a[3] = 4; 12 for( int i=4; i<=45; i++ ) 13 a[i] = a[i-1]+a[i-2]; 14 while( ~scanf("%d", &n ) ) { 15 printf("%I64d\n", a[n] ); 16 } 17 }