Advertisement
Spocoman

01. SoftUni Reception

Nov 8th, 2023 (edited)
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int first, second, third, students, counter = 1, hours = 0;
  7.     cin >> first >> second >> third >> students;
  8.  
  9.     while (students > 0) {
  10.         students -= first + second + third;
  11.         hours += (counter % 3 == 0 && students > 0 ? 2 : 1);
  12.         counter += 1;
  13.     }
  14.  
  15.     cout << "Time needed: " << hours << "h.\n";
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement