http://acm.hdu.edu.cn/showproblem.php?pid=2085
注意数据存储
2010-10-29 18:00:38 | Accepted | 2085 | 0MS | 180K | 259 B | G++ | rll |
代码
#include<stdio.h>
int main()
{
__int64 a[35],b[35];
int i,n;
a[0]=1;b[0]=0;
for(i=1;i<35;i++)
{
a[i]=3*a[i-1]+2*b[i-1];
b[i]=a[i-1]+b[i-1];
}
while(scanf("%d",&n)!=EOF&&n!=-1)
{
printf("%I64d, %I64d\n",a[n],b[n]);
}
return 0;
}