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<stdio.h> #include<math.h> int main() { long i,j,k,l,t,n,s; int a[110]; double pi; while(cin>>n,n!=0) { k=0;s=0; for(i=0;i<100;i++) a[i]=0; for(i=1;i<=n;i++) { cin>>a[i]; if ((a[i]==1)||(a[i]==0)) {i--;n--;} } for(i=1;i<=n-1;i++) for(j=i+1;j<=n;j++) { t=1; for(l=2;l<=a[i];l++) if ((a[i]%l==0)&&(a[j]%l==0)) {t=l;break;} if (t==1) k++; } s=n*(n-1)/2; if (k!=0) {pi=sqrt(6*s/k);printf("%1.6lf\n",pi);} else cout<<"No estimate for this data set."<<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