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 tengshengbo at 2004-09-24 19:41:39 on Problem 1819
#include<iostream.h>
#include<math.h>
int main(int argc, char* argv[])
{
   int n,i,j,k;
   double di[1001];
   int qie[1001];
   double wei[1001];
   double x;
   int re[1001];
   cin>>n;
   for(i=1;i<=n;i++)
      cin>>di[i];
   qie[1]=0;
   wei[1]=di[1];
   for(i=2;i<=n;i++)
   {
       wei[i]=di[i];
       qie[i]=0;
       for(j=1;j<i;j++)
       {
          x=sqrt(di[i]*di[j])*2+wei[j];
          if(x-wei[i]>0.0001)
          {
             wei[i]=x;
             qie[i]=j;
          }
       }
   }
   j=0;
   for(i=1;i<n;i++)
          if(qie[i+1]<i)
          {
            re[j]=i;
            j++;
          }
   cout<<j<<endl;
   for(i=0;i<j;i++)
     cout<<re[i]<<endl;
        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