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

怎么回事?老是 RUNTIME ERROR

Posted by sunflowwer at 2006-08-07 17:12:40 on Problem 1862
#include <stdio.h>
#include <math.h>

int main()
{
       int i,m,n;
	   int v1,v2;double s;int c;
	   double a1,a2;double map[100];
	   scanf("%d",&n);
	   for(i=0;i<n;i++){
		   scanf("%d",&c);
	       map[i]=double(c);
	   }
	   m=n-1;
	   while(m--)
	   {
	       a1=0.0;a2=0.0;v1=0;v2=0;
		   for(i=0;i<n;i++)
			   if(map[i]>a1){
			        a2=a1;v2=v1;
					a1=map[i];v1=i;
			   }
			   else if(map[i]>a2){
			        a2=map[i];
					v2=i;
			   }
		   s=map[v1]*map[v2];
		   map[v1]=2*sqrt(s);
		   map[v2]=0.0;
	   }
	   printf("%.3lf\n",map[v1]);
	   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