标签:amp sum == c代码 col namespace class div hdoj
AC代码:
#include <iostream> #include <cstdio> using namespace std; int main(void) { freopen("in.txt","r",stdin); int n; while(scanf("%d",&n)!=EOF) { long long sum1,sum2,sum; sum1=3; sum2=8; if(n==1) sum=sum1; else if(n==2) sum=sum2; else for(int i=3;i<=n;i++) { sum=2*sum2+2*sum1; sum1=sum2; sum2=sum; } printf("%lld\n",sum); } fclose(stdin); return 0; }
标签:amp sum == c代码 col namespace class div hdoj
原文地址:https://www.cnblogs.com/phaLQ/p/9938376.html