Advertisement
Spocoman

02. Hospital

Sep 21st, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.60 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var period, patients int
  7.     fmt.Scanln(&period)
  8.  
  9.     var treated = 0
  10.     var untreated = 0
  11.     var doctors = 7
  12.  
  13.     for i := 1; i <= period; i++ {
  14.         fmt.Scanln(&patients)
  15.         if untreated > treated && i % 3 == 0 {
  16.             doctors++
  17.         }
  18.         if patients > doctors {
  19.             treated += doctors
  20.             untreated += patients - doctors;
  21.         } else {
  22.             treated += patients
  23.         }
  24.     }
  25.  
  26.     fmt.Printf("Treated patients: %d.\n", treated)
  27.     fmt.Printf("Untreated patients: %d.\n", untreated)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement