Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class HelloWorld {
- public static void main(String[] args) {
- Scanner sc =new Scanner(System.in);
- int periodDays = Integer.parseInt(sc.nextLine());
- int patientsTreated = 0;
- int patientsUntreated = 0;
- int doctors = 7;
- for (int i = 1; i <= periodDays ; i++) {
- int patients = Integer.parseInt(sc.nextLine());
- if (i % 3 == 0) {
- if (patientsTreated < patientsUntreated) {
- doctors++;
- }
- }
- if (patients <= 7) {
- patientsTreated += patients;
- } else {
- patientsTreated += doctors;
- patientsUntreated += patients - doctors;
- }
- }
- System.out.printf("Treated patients: %d.%n",patientsTreated);
- System.out.printf("Untreated patients: %d.%n",patientsUntreated);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement