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 |
1. why Huge input,scanf is recommended.?2.what the hell with the time limit thing. #include<iostream> #include<iomanip> #include<string> using namespace std; int main() { string m1,m2; int n,k,x=0,pp[3],limit,d[7]={1,0,0,2,1,1,0}; pp[2]=101; while(cin>>n) { if(n==0)break; if(x)cout<<endl; x=1; cin>>k; int p[101]={0},w[101]={0}; limit=k*((n*(n-1))/2); for(int i=0;i<limit;i++) { cin>>pp[0]>>m1>>pp[1]>>m2; w[pp[d[m1[0]-m2[0]+3]]-1]++; p[pp[d[m1[0]-m2[0]+3]]-1]++; p[pp[d[m2[0]-m1[0]+3]]-1]++; } for(int i=0;i<n;i++) { if(p[i]==0){cout<<"-"<<endl;continue;} cout<<fixed<<setprecision(3)<<float(w[i])/p[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