Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
超时了,请你们帮帮忙啊,不知道哪里超时?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator