| ||||||||||
| 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 | |||||||||
why WA???????????????????????????????????????#include <stdio.h>
int main(int argc, char* argv[])
{
int n,m,i,j,k=0;
char a[20];
double d,fd,ld,pos,pos1;
while(gets(a)&&scanf("%d%d",&n,&m)==2)
{
gets(a);
gets(a);
k++;
j=0;
pos1=d=0;
fd=(float)10000/n;
ld=(float)10000/(n+m);
for(i=1;i<n;i++)
{
pos=i*fd;
while(pos1<pos)
{
j++;
pos1=j*ld;
}
d+=(pos1-pos>=pos-pos1+ld)?(pos-pos1+ld):(pos1-pos);
}
printf("sample output #%d\n",k);
int t=d;
if(t==d)
printf("%d.0\n",t);
else
printf("%.4lf\n",d);
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