Show/Hide Code
//Headers #include <set> #include <map> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <cctype> #include <cstdio> #include <string> #include <vector> #include <cassert> #include <cstdlib> #include <cstring> #include <sstream> #include <iostream> #include <algorithm> #include <climits> #include <clocale> //Defines #define pow2(i) (1<<i) #define bit(i) (1<<i) #define isOdd(i) (i&1) #define isEven(i) (!(i&1)) #define isPrime(i) ((i==2) || ((i&1) && !pTest[i])) //pTest has to be the bool array's name #define sz(i) i.size() #define vec(type,name) vector< type > name #define rep(i,a,b) for(int i=a ; i<=b ; i++) #define swap(type,a,b) {type t=a; a=b; b=t;} #define sum(a,n) ( (n*(n+1)/2) - (a-1)*a/2 ) #define iscap(i) (i>='A'&&i<='Z') #define issmall(i) (i>='a'&&i<='z') #define isnum(i) (i>='0'&&i<='9') #define issymbol(i) (!(i>='a'&&i<='z') && !(i>='A'&&i<='Z') && !(i>='0'&&i<='9')) #define mk(i,j) make_pair(i,j) #define ERROR 1e-11 #define rock "rock" #define paper "paper" #define scissors "scissors" //Type Defs typedef long long lint; typedef unsigned long long ulint; typedef long double ldouble; using namespace std; int pw[200], pl[200]; int main() { // TEST CASE // int kase=1, kounter=1; //freopen("input.txt","r",stdin); //freopen("outptu.txt","w+",stdout); string m1, m2; int p1, p2, i, n, k; double w; bool pr=false; cout.precision(3); while ( cin >> n ) { if (!n) break; cin >> k; w=-1000; if (pr) cout << endl; if (!pr) {pr=true;} k = k*n*(n-1)/2; for (i=0 ; i<=100 ; i++) pw[i]=pl[i]=0; while (k--) { cin >> p1 >> m1 >> p2 >> m2; if (m1==rock && m2==scissors) { pw[p1]++; pl[p2]++; } if (m1==rock && m2==paper) { pw[p2]++; pl[p1]++; } if (m1==paper && m2==rock) { pw[p1]++; pl[p2]++; } if (m1==paper && m2==scissors) { pw[p2]++; pl[p1]++; } if (m1==scissors && m2==rock) { pw[p2]++; pl[p1]++; } if (m1==scissors && m2==paper) { pw[p1]++; pl[p2]++; } } for (i=1 ; i<=n ; i++) { w = ((double)pw[i] / (double)(pw[i]+pl[i])); if (pw[i]+pl[i]==0) printf("-\n"); else printf("%.3lf\n",w); } } return 0; }
someone would give me the test cases of problem 10903 rock, paper?
ReplyDelete