Advertisement
Spocoman

Happy Cat Parking

Sep 7th, 2024
1,015
0
Never
5
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int days, hours;
  8.     cin >> days >> hours;
  9.  
  10.     double total = 0;
  11.  
  12.     for (int day = 1; day <= days; day++) {
  13.         double sum = 0;
  14.  
  15.         for (int hour = 1; hour <= hours; hour++) {
  16.             if (day % 2 == 0 && hour % 2 == 1) {
  17.                 sum += 2.50;
  18.             }
  19.             else if (day % 2 == 1 && hour % 2 == 0) {
  20.                 sum += 1.25;
  21.             }
  22.             else {
  23.                 sum++;
  24.             }
  25.         }
  26.         printf("Day: %i - %.2f leva", day, sum);
  27.         total += sum;
  28.     }
  29.  
  30.     printf("Total: %.2f leva", total);
  31.  
  32.     return 0;
  33. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement