Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int first, second, third, students, counter = 1, hours = 0;
- cin >> first >> second >> third >> students;
- while (students > 0) {
- students -= first + second + third;
- hours += (counter % 3 == 0 && students > 0 ? 2 : 1);
- counter += 1;
- }
- cout << "Time needed: " << hours << "h.\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement