Advertisement
Spocoman

02. Sleepy Tom Cat

Sep 16th, 2024
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.63 KB | None | 0 0
  1. package main
  2. import (
  3.     "fmt"
  4.     "math"
  5. )
  6.  
  7. func main() {
  8.     var day int
  9.     fmt.Scanln(&day)
  10.     var workdayMinutes = (365 - day) * 63
  11.     var holidayMinutes = day * 127
  12.     var totalMinutes = workdayMinutes + holidayMinutes
  13.     var diffMinutes = int(math.Abs(float64(totalMinutes) - 30000))
  14.  
  15.     if (totalMinutes >= 30000) {
  16.         fmt.Println("Tom will run away")
  17.         fmt.Printf("%d hours and %d minutes more for play", diffMinutes / 60, diffMinutes % 60)
  18.     } else {
  19.         fmt.Println("Tom sleeps well")
  20.         fmt.Printf("%d hours and %d minutes less for play", diffMinutes / 60, diffMinutes % 60)
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement