Advertisement
Spocoman

Three brothers

Oct 9th, 2023
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double firstTime, secondTime, thirdTime, fatherTime;
  8.     cin >> firstTime >> secondTime >> thirdTime >> fatherTime;
  9.    
  10.     double cleaningTime = 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15;
  11.  
  12.     printf("Cleaning time: %.2f\n", cleaningTime);
  13.     if (fatherTime > cleaningTime) {
  14.         printf("Yes, there is a surprise - time left -> %.0f hours.\n", floor(fatherTime - cleaningTime));
  15.     }
  16.     else {
  17.         printf("No, there isn't a surprise - shortage of time -> %.0f hours.\n", ceil(cleaningTime - fatherTime));
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement