| ||||||||||
| 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 | |||||||||
怎么老是Time Limit Exceeded#include<stdio.h>
int main()
{
int i=0,n=1,b[10];
float s=0.0,m=0.01,a=0.01,c[10];
while(a!=0)
{
scanf("%f",&a);
if(a>5.20) printf("input error\n");
else {c[i]=a;i++;}
}
while(m>0)
{
s=s+1/(n+1);
for(i=0;c[i]>0;i++)
{
if(c[i]<s) b[i]=n;
m=c[i];
}
n++;
}
b[i+1]=0;
for(i=0;b[i]>0;i++)
printf("%5dcard(s)",b[i]);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator