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

Re:哪位大牛帮忙看看哪里错了,怎么老是WR呢?????

Posted by ecjtubaowp at 2007-03-03 23:14:20 on Problem 1491
In Reply To:哪位大牛帮忙看看哪里错了,怎么老是WR呢????? Posted by:bjss222 at 2007-03-03 01:28:16
> #include<stdio.h>
> #include<math.h>
> 
> int commonfactor(int a, int b)   
> {
> 	int n;
> 	while(a!=0)
> 	{
>        n=b%a; b=a; a=n;
> 	}
> 	if(b==1) return 1;
> 	else     return 0;
> } 
> 
> int main()
> {
> 	int n;
> 	while(scanf("%d", &n), n>0)
> 	{
> 		int m[50], i, j, sum=0;
> 		double x;
> 
> 		for(i=0; i<n; i++)
> 			scanf("%d", &m[i]);
>         for(i=0; i<n-1; i++)
> 			for(j=i+1; j<n; j++)
> 				if(commonfactor(m[i], m[j]))
> 					sum++;
>         if(sum>0)
> 		{
> 			x = pow(3.0*n*(n-1)/sum, 0.5);
> 		    printf("%.6lf\n", x);
> 		}
> 		else   printf("No estimate for this data set.\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