Advertisement
DidiMilikina

Задача 2 - Фирма

Sep 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.     double needed_hours;
  9.     double days;
  10.     double overtime_workers;
  11.     cin >> needed_hours >> days >> overtime_workers;
  12.  
  13.     double real_days = days * 0.9;
  14.     double working_hours = floor(real_days * 8);
  15.     double overtime = overtime_workers * 2 * days;
  16.     double total_working_hours = working_hours + overtime;
  17.  
  18.     if (total_working_hours >= needed_hours)
  19.     {
  20.         double left_hours = total_working_hours - needed_hours;
  21.         cout << "Yes!" << left_hours << " hours left." << endl;
  22.     }
  23.     else
  24.     {
  25.         double insufficient_hours = needed_hours - total_working_hours;
  26.         cout << "Not enough time!" << insufficient_hours << " hours needed." << endl;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement