Advertisement
Imran1107048

ICPC_Preli_2023_G

Oct 14th, 2023
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  5. #define int long long
  6. #define endl "\n"
  7. #define PI acos(-1.0)
  8. #define IN freopen("input.txt",'r',stdin)
  9.  
  10. const int MOD = 1e9+7;
  11. const int INF = 2e5+5;
  12. const int N = 205;
  13.  
  14. int BIGMOD(int b, int p)
  15. {
  16. int ans = 1 % MOD, x = b % MOD;
  17. while(p){
  18. if(p&1)ans = (ans * x)%MOD;
  19. x = (x*x)%MOD;
  20. p >>= 1LL;
  21. }
  22. return ans;
  23. }
  24.  
  25. void solve();
  26. int32_t main()
  27. {
  28. IOS;
  29. cout << fixed << setprecision(10);
  30. int _ = 1;
  31. cin >> _;
  32. while(_--) solve();
  33. return 0;
  34. }
  35.  
  36. void solve()
  37. {
  38. string s;
  39. cin >> s;
  40. int sz = s.size();
  41. if(sz == 6){
  42. cout << "1.0 Over ";
  43. }
  44. else if(sz < 6){
  45. cout << "0." << sz << " Over ";
  46. }
  47. else{
  48. cout << sz / 6 << "." << sz%6 << " Overs ";
  49. }
  50. int wicket = 0;
  51. int run = 0;
  52. for(int i=0;i<sz;i++){
  53. if(s[i] == 'W'){
  54. wicket++;
  55. }
  56. else{
  57. run += (s[i] - '0');
  58. }
  59. }
  60. cout << run;
  61. if(run < 2){
  62. cout << " Run ";
  63. }
  64. else{
  65. cout << " Runs ";
  66. }
  67. cout << wicket;
  68. if(wicket < 2){
  69. cout << " Wicket.\n";
  70. }
  71. else{
  72. cout << " Wickets.\n";
  73. }
  74. }
  75.  
  76. ///Must see the constraints range
  77. ///Calculate the Time
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement