algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

main.cpp (934B)


      1 #include <iostream>
      2 #include <vector>
      3 #include <unordered_set>
      4 #include <unordered_map>
      5 #include <algorithm>
      6  
      7 #define ll long long
      8  
      9 using namespace std;
     10  
     11 int main() {
     12     int testCases, x,y,z;
     13     cin >> testCases;
     14  
     15     for(int m = 0; m < testCases; ++m) {
     16  
     17         cin >> x;
     18         cin >> y;
     19         cin >> z;
     20  
     21         int sum = x + y + z;
     22  
     23         if(x >= y && x >= z) {
     24  
     25             for(int i = 0; i < sum; ++i) {
     26                 cout << 'P'; // most rocks
     27             }
     28             cout << endl;
     29  
     30         } 
     31         else if(y >= x && y >=z) {
     32             for(int i = 0; i < sum; ++i) {
     33                 cout << 'R'; // most scissors
     34             }
     35             cout << endl;
     36  
     37         }
     38         else if(z >= x && z >= y) {
     39             for(int i = 0; i < sum; ++i) {
     40                 cout << 'S'; // most paper
     41             }
     42             cout << endl;
     43         } else {
     44             cout << "UNKNOWN" << endl;
     45         }
     46     }
     47 }