Problem Description
There is a cow, which has a small cow at the beginning of each year. Each heifer starts its fourth year with a heifer. Please program implementation how many cows are there in the first n years?
Input
The input data consists of multiple test instances, one for each test instance, including an integer n (0<n<55), and the meaning of n as described in the topic.
N=0 indicates the end of the input data and does not handle it.
Output
For each test instance, output the number of cows in the nth year.
Each output occupies one row.
Sample Input
2450
Sample Output
246
HINT
1#include <stdio.h>2 intMain ()3 {4 intf[ -]={1,1,2,3},n,i;5 for(i=4;i< -; i++)6 {7f[i]=f[i-1]+f[i-3];8 }9 while(SCANF ("%d", &n)!=eof&&n!=0)Ten { Oneprintf"%d\n", F[n]); A } - return 1; -}
Wuhan University of Science and Technology acm:1010:0 starting point algorithm 89--cow Story