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
欢迎参加IJCAI 2020麻将智能体竞赛,大奖等你拿!Welcome to IJCAI 2020 Mahjong AI competition with amazing prizes! | 北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

why WA???????????????????????????????????????

Posted by BJ051155 at 2007-04-27 15:14:19 on Problem 3154
#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:
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