Advertisement
Spocoman

Deer of Santa

Oct 6th, 2024
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.55 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6. )
  7.  
  8. func main() {
  9.     var days int
  10.     fmt.Scanln(&days)
  11.    
  12.     var availableFood, deer1, deer2, deer3 float64
  13.     fmt.Scanln(&availableFood)
  14.     fmt.Scanln(&deer1)
  15.     fmt.Scanln(&deer2)
  16.     fmt.Scanln(&deer3)
  17.  
  18.     availableFood -= (deer1 + deer2 + deer3) * float64(days)
  19.  
  20.     if availableFood >= 0 {
  21.         fmt.Printf("%d kilos of food left.", int(math.Floor(availableFood)))
  22.     } else {
  23.         fmt.Printf("%d more kilos of food are needed.", int(math.Ceil(math.Abs(availableFood))))
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement