Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by todor on 16.02.2017 г..
- */
- public class Dummy {
- public static void main(String[] args) {
- int doctors = 7;
- Scanner scan = new Scanner(System.in);
- int workDays = Integer.parseInt(scan.nextLine());
- int treatedPatients = 0;
- int untreatedPatients = 0;
- for (int i = 1; i <= workDays; i++) {
- if (i % 3 == 0 && treatedPatients < untreatedPatients){
- doctors++;
- }
- int todayPatientsCount = Integer.parseInt(scan.nextLine());
- boolean areDoctorsEnough = todayPatientsCount <= doctors;
- untreatedPatients += areDoctorsEnough ? 0 : todayPatientsCount - doctors;
- treatedPatients += areDoctorsEnough ? todayPatientsCount : doctors;
- }
- System.out.printf("Treated patients: %d.%n", treatedPatients);
- System.out.printf("Untreated patients: %d.", untreatedPatients);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement