1 #include<stdio.h> 2 int main() 3 { 4 int i,n; 5 __int64 high,low,k; 6 while(scanf("%d",&n),n+1) 7 { 8 for(high=1,low=i=0;i<n;++i) 9 { 10 k=high; 11 high=3*high+2*low; 12 low=k+low; 13 } 14 printf("%I64d, %I64d\n",high,low); 15 } 16 return 0; 17 }
1 #include<stdio.h> 2 int main() 3 { 4 int i,n; 5 __int64 high,low,k; 6 while(scanf("%d",&n),n+1) 7 { 8 for(high=1,low=i=0;i<n;++i) 9 { 10 k=high; 11 high=3*high+2*low; 12 low=k+low; 13 } 14 printf("%I64d, %I64d\n",high,low); 15 } 16 return 0; 17 }