Advertisement
Spocoman

02. Sleepy Tom Cat

Sep 4th, 2023
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     const int WORKING_DAY_MINUTES_TO_PLAY = 63;
  7.     const int HOLIDAY_MINUTES_TO_PLAY = 127;
  8.     const int ANNUAL_RATE_OF_PLAY_IN_MINUTES = 30000;
  9.  
  10.     int holidaysCount;
  11.     cin >> holidaysCount;
  12.  
  13.     int workingDayMinutes = (365 - holidaysCount) * WORKING_DAY_MINUTES_TO_PLAY;
  14.     int holidayMinutes = holidaysCount * HOLIDAY_MINUTES_TO_PLAY;
  15.     int sumMinutes = workingDayMinutes + holidayMinutes;
  16.     int result = abs(sumMinutes - ANNUAL_RATE_OF_PLAY_IN_MINUTES);
  17.  
  18.     cout << (sumMinutes >= 30000 ? "Tom will run away" : "Tom sleeps well") << endl;
  19.  
  20.     cout << result / 60 << " hours and " << result % 60 << " minutes " << (sumMinutes >= 30000 ? "more" : "less") << " for play" << endl;
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement