Untitled
unknown
plain_text
2 months ago
1.4 kB
2
Indexable
Never
#include <bits/stdc++.h> using ll = long long; using ull = unsigned long long; #define MAX 1000005 #define passIO cin, cout #define IO ifstream& cin, ofstream& cout #define xx first #define yy second #define mp make_pair #define pb push_back #define endl '\n' #define sz(a) (int)(a.size()) #define all(v) (v).begin(),(v).end() int const MOD = 1e9 + 7; const double PI = acos(-1.0); using namespace std; /* Rough & Note: */ class Solution { public: void test_cases() { string balls; cin >> balls; int totalBall = sz(balls), overs = totalBall / 6, remainBall = totalBall % 6, runs = 0, wickets = 0; for (int x : balls) { if (x == 'W') wickets++; else runs += (x - 48); } string cmd = {"Overs", "Over", "Runs", "Run", "Wickets", "Wicket"}; if (runs > 1) { if (wickets > 1) { if (totalBall > 6) { printf("%d.%d Overs %d Runs %d Wickets.\n", overs, remainBall, runs, wickets); } else printf("%d.%d Over %d Runs %d Wickets.\n", overs, remainBall, runs, wickets); } else printf("%d.%d Over %d Runs %d Wicket.\n", overs, remainBall, runs, wickets); } else printf("%d.%d Overs %d Run %d Wickets.\n", overs, remainBall, runs, wickets); } }; int main() { int tc = 1, caseno = 0; Solution solveFunc; cin >> tc; while(tc--) { cout << "Case " << ++caseno << ": "; solveFunc.test_cases(); } return 0; }