在成为acmer后,因为自己菜,逐渐丧失了A题动力,但不学习将会人财两空,所以今天我还是坚持水题吧!!!!题目如下
http://www.fjutacm.com/Problem.jsp?pid=1168
1 3 2
1 3 2
#include<stdio.h> int main(){ int a; while(~scanf("%d",&a)){ long long s[65]={0}; long long sum=0; s[0]=1; s[1]=2; for(int i=2;i<a;i++){ s[i]=s[i-1]+s[i-2]; sum=s[i]; } if(a>2)printf("%lld\n",sum); else printf("%d\n",a); } return 0; }
明明是递归的题,但是递归时间超限了,所以就循环了,氵氵氵氵
原文:https://www.cnblogs.com/TYoUer/p/14305113.html