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 |
怎么AC不了呢?#include<iostream> #include<math.h> #include<iomanip> #include<string.h> using namespace std; //int a[50]; inline bool com(int a,int b) { int t; if(a<b){t=a;a=b;b=t;} while(b) {t=a%b;a=b;b=t;} if(a>1)return 1; else return 0; } int main() { int n; while(cin>>n&&n) { //memset(a,0,50); int *a = new int[n]; for(int i=0;i<n;i++) cin>>a[i]; int count=0; for(int i=0;i<n-1;i++) for(int j=i+1;j<n;j++) if(!com(a[i],a[j]))count++; if(count==0)cout<<"No estimate for this data set."<<endl; else cout<<setiosflags(ios::fixed)<<setprecision(6)<<sqrt(3*n*(n-1)/count)<<endl; delete []a; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator