西工大NOJ100题+解答(14)
发布时间:2021-06-08
发布时间:2021-06-08
#include<stdio.h> int main() {
int a1=1,a2=1,n=2,sum=2,t; while(sum<=100){ t=a1; a1=a2;
a2=t+2*a2; sum=sum+a2; n++; }
printf("%d\n",n-1); while(sum<=1000){ t=a1; a1=a2;
a2=t+2*a2; sum=sum+a2; n++; }
printf("%d\n",n-1); while(sum<=10000){ t=a1; a1=a2;
a2=t+2*a2;