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

大牛们 帮我看看 郁闷 WA了。。。。哪错了?

Posted by x56268805 at 2006-08-08 08:40:20 on Problem 1018
#include<iostream>
#include <stdio.h>
using namespace std;
#define M 500
int a[M];
int b[M];
int c[M];
int main()
{
	int n,m,d,min,j,i,k,t;	
	cin>>n;
	while(n--)
	{	 
		k=0; 
		t=0;
		cin>>m;		 
		float p=0.000;
		for(j=0;j<m;j++)
		{
			cin>>b[j];			   
			for(i=0;i<2*b[j];i++)					
				cin>>a[i];			
			i=0;	
			c[k]=0;
			do{
				if(c[k]<a[i])				    
				{   
					c[k]=a[i];
					c[k+1]=a[i+1];							
				}
				i++;
			}while(i<2*b[j]);		  	
			k+=2;			
		}
		min=c[0];
		for(d=2;d<k;d+=2)
		{	
			if(min>c[d])
				min=c[d];
		}			
		for(d=1;d<k;d+=2)
			t+=c[d];              
		p=float(min)/t;	
		printf("%.3lf\n",p);	
	}
	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