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大学生程序设计竞赛训练》暑期课面向全球招生!

Re:Help me.thanks.

Posted by fify at 2007-07-12 15:46:09 on Problem 3154
In Reply To:Help me.thanks. Posted by:kuangwenkui at 2007-06-16 16:30:42
> #include<stdio.h>
> main()
> {float a,sum[100],p,q,s=0;
> int i,j,k,n,m;
>   for(k=1;k<100 ;k++)
>      {printf("sample input #%d\n",k);
>        scanf("%d %d",&n,&m);
>        for(i=1;i<n;i++)
> 	  { sum[i]=1;
> 	  for(j=1;j<m+n;j++)
> 	      { p=(float)(i/n);
> 	       q=(float)(j/(m+n));printf("%f %f",p,q);
> 	      if( p>q)
> 		 a=p-q;
> 		 else a=q-p;
> 	      if(sum[i]>a)
> 		  sum[i]=a;
> 	       else continue;
> 	      }
> 	    s=sum[i]+s;
> 	   }
> 	   s=s*10000;
> 	 printf("sample output #%d\n%.4f\n",k,s);
> 	}
> }

No "sample input" or "sample output" needed in the printf function!

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