Advertisement
Spocoman

08. Lunch Break

Sep 17th, 2023 (edited)
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include<cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string serialName;
  10.     getline(cin, serialName);
  11.  
  12.     int serialTime, breakTime;
  13.     cin >> serialTime >> breakTime;
  14.  
  15.     double neededTime = breakTime / 8.0 + breakTime / 4.0 + serialTime;
  16.  
  17.     if (neededTime <= breakTime)
  18.     {
  19.         cout << "You have enough time to watch " << serialName << " and left with " << breakTime - floor(neededTime) << " minutes free time.\n";
  20.     }
  21.     else
  22.     {
  23.         cout << "You don't have enough time to watch " << serialName << ", you need " << ceil(neededTime) - breakTime<< " more minutes.\n";
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement