Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<iomanip>
- using namespace std;
- int main()
- {
- int n,k;
- bool first=true;
- while(cin>>n){
- if(n==0)
- break;
- cin>>k;
- int win[1000]={0};
- int lose[1000]={0};
- int sum[1000]={0};
- int p1,p2;
- string m1,m2;
- int i=0;
- while(cin>>p1>>m1>>p2>>m2){
- ++i;
- if((m1=="paper"&&m2=="rock")||(m1=="rock"&&m2=="scissors")||(m1=="scissors"&&m2=="paper")){
- ++win[p1];
- ++lose[p2];
- ++sum[p1];
- ++sum[p2];
- }
- else if((m2=="paper"&&m1=="rock")||(m2=="rock"&&m1=="scissors")||(m2=="scissors"&&m1=="paper")){
- ++win[p2];
- ++lose[p1];
- ++sum[p1];
- ++sum[p2];
- }
- if(i==k*n*(n-1)/2)
- break;
- }
- if(!first)
- cout<<endl;
- for(int j=1;j<=n;++j)
- if(sum[j]==0)
- cout<<"-"<<endl;
- else
- cout<<fixed<<setprecision(3)<<(double)win[j]/sum[j]<<endl;
- first=false;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement