一头母牛从出生后,每两年可以生下一头母牛,即在第二年和第四年分别可产下一头母牛,出生后第五年将会死去。假设农场现有一头母牛,N年后农场的母牛数目是多少,编写程序实现
#include "stdio.h"
#include "windows.h"
long CowNum(int years);
long cow1(int years);
long cow2(int year);
int CowCntAftNyears(int n);
int GetCowNum(int N);
void main()
{
int n = 50;
DWORD start = GetTickCount();
printf("%d ",CowNum(n) );
printf("======CowNum=====%d\n" ,(start - GetTickCount() ));
start = GetTickCount();
printf("%d ",cow1(n) );
printf("======cow1==========%d\n", (start - GetTickCount()));
sta