Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Exercise_kursova_rabota {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int period = Integer.parseInt(sc.nextLine());
- int treatedPatients = 0;
- int untreatedPatients = 0;
- int countOfDoctors = 7;
- for (int day = 1; day <= period; day++) {
- int currentPatients = Integer.parseInt(sc.nextLine());
- if ((day % 3 == 0) && (untreatedPatients > treatedPatients)) {
- countOfDoctors++;
- }
- if (currentPatients > countOfDoctors) {
- treatedPatients += countOfDoctors;
- untreatedPatients += currentPatients - countOfDoctors;
- } else {
- treatedPatients += currentPatients;
- }
- }
- System.out.println("Treated patients: " + treatedPatients);
- System.out.println("Untreated patients: " + untreatedPatients);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement