Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class bolnica {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int period = scanner.nextInt();
- int treatedPatients = 0;
- int untreatedPatients = 0;
- int countOfDoctor = 7;
- for (int day = 1; day <= period; day++){
- int currentPatients = scanner.nextInt();
- if ((day % 3 == 0) && (untreatedPatients > treatedPatients)){
- countOfDoctor++;
- }
- if (currentPatients > countOfDoctor) {
- treatedPatients += countOfDoctor;
- untreatedPatients += currentPatients - countOfDoctor;
- }else{
- treatedPatients += currentPatients;
- }
- }
- System.out.printf("izlekuvani %d ", treatedPatients);
- System.out.printf("che umrat %d", untreatedPatients);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement