HDU/2018/main.c
Saturneric 0525ffad24 Add.
2020-09-01 00:48:58 +08:00

22 lines
392 B
C

#include <stdio.h>
#define MAX 65535
int main(void){
int numbers = 1;
long temp = 0;
while(scanf("%d",&numbers) == 1){
if(!numbers) continue;
int i;
long adult = 1,cowsa = 0, cowsb = 0, cowsc = 0;
for(i = 1; i < numbers; i++){
temp = cowsa;
cowsa = adult;
adult += cowsb;
cowsb = temp;
}
printf("%ld\n",adult + cowsa + cowsb + cowsc);
getchar();
}
return 0;
}