| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么wa?我实在找不出错误了,清高手指点#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator