SHARE
TWEET

Untitled

a guest Feb 14th, 2020 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Hospital {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int perioada =scanner.nextInt();
  8.         int pacientiVazuti = 0;
  9.         int pacientiNevazuti = 0;
  10.  
  11.         for (int i = 1 ; i <= perioada ; i++){
  12.  
  13.             if ( i % 3 == 0 && pacientiNevazuti>pacientiVazuti)
  14.             {
  15.                 pacientiVazuti += 1;
  16.                 pacientiNevazuti -= 1;
  17.             }
  18.             int pacienti = scanner.nextInt();
  19.             if (pacienti >=7)
  20.                 pacientiVazuti += 7;
  21.             else
  22.                 pacientiVazuti += pacienti;
  23.             if(pacienti > 7)
  24.                 pacientiNevazuti += pacienti - 7;
  25.  
  26.         }
  27.         System.out.printf("Treated patients: %d.\n",pacientiVazuti);
  28.         System.out.printf("Untreated patients: %d.\n",pacientiNevazuti);
  29.  
  30.     }
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top