Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package kr_1;
- import java.util.Scanner;
- public class KursovaRabotaZadacha4 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int period = Integer.parseInt(scanner.nextLine());
- System.out.println();
- int treatedPatients = 0;
- int untreatedPatients = 0;
- int countOfDoctors = 7;
- for (int day = 1; day <= period; day++) {
- int CurrentPatients = Integer.parseInt(scanner.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