Advertisement
MiinaMagdy

12157 - Tariff Plan

Sep 1st, 2022
938
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define endl '\n'
  7. #define sz(x) int(x.size())
  8. #define all(x) x.begin(), x.end()
  9.  
  10. int main() {
  11.     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  12.     int testcases;
  13.     cin >> testcases;
  14.     for (int test = 1; test <= testcases; test++) {
  15.         int n, x;
  16.         cin >> n;
  17.         int a = 0, b = 0;
  18.         for (int i = 0; i < n; i++) {
  19.             cin >> x;
  20.             a += 10 * (x / 30 + 1);
  21.             b += 15 * (x / 60 + 1);
  22.         }
  23.         cout << "Case " << test << ": ";
  24.         if (min(a, b) == a) cout << "Mile ";
  25.         if (min(a, b) == b) cout << "Juice ";
  26.         cout << min(a, b) << endl;
  27.     }
  28.     return 0;
  29. }
  30.  
Tags: UVA CP3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement