Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

超时了,请你们帮帮忙啊,不知道哪里超时?

Posted by dordy at 2008-11-09 11:47:34 on Problem 1953
#include<stdio.h>
int i,k;
int a[46];
long b[46];
int bit(int i)
{

	if(i==1)   return 2;
	else if(i==2)   return 3;
	else if(i>2)    return b[i]=bit(i-1)+bit(i-2);
	else  return 0;
}

int main()
{   
	scanf("%d",&k);
	while(k>45) 
	{
		printf("k值不要大于45,请重新输入:");
		scanf("%d",&k);
	}
	for(i=0;i<k;i++)
	{
	    scanf("%d",&a[i]);
		printf("Scenario #%d:\n%d\n",i+1,bit(a[i]));
	}	
	printf("\n");
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator