BapBapuHa

Untitled

Jul 5th, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package com.company;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7. int firstEmployeeEfficiency = Integer.parseInt(scanner.nextLine());
  8. int secondEmployeeEfficiency = Integer.parseInt(scanner.nextLine());
  9. int thirdEmployeeEfficiency = Integer.parseInt(scanner.nextLine());
  10. int studentsCount = Integer.parseInt(scanner.nextLine());
  11. int studentsCounter = 0;
  12. int hoursCounter = 0;
  13. int hours = 0;
  14. while (studentsCount > studentsCounter) {
  15. studentsCounter = studentsCounter + firstEmployeeEfficiency + secondEmployeeEfficiency
  16. + thirdEmployeeEfficiency;
  17. hoursCounter++;
  18. hours ++;
  19. if (hoursCounter % 4 == 0) {
  20. hours++;
  21. }
  22. }
  23. System.out.printf("Time needed: %dh.", hours);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment