标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 11922 Accepted Submission(s):
5420
5 2 -1
571, 209 11, 4 提示 可以使用long long int对付GNU C++,使用__int64对付VC6
1 #include<stdio.h> 2 __int64 biao[35],sieve[35]; 3 int main() 4 { 5 int i,j,n; 6 biao[1]=3;sieve[1]=1; 7 for(i=2;i<34;i++) 8 { 9 biao[i]=biao[i-1]*3+sieve[i-1]*2; 10 sieve[i]=biao[i-1]+sieve[i-1]; 11 } 12 while(~scanf("%d",&n)&&n!=-1) 13 { 14 if(n==0) 15 printf("1, 0\n"); //最近总会忘记对初始条件进行判断; 16 else 17 printf("%I64d, %I64d\n",biao[n],sieve[n]); 18 } 19 return 0; 20 }
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4575892.html