Advertisement
Spocoman

Three brothers

Oct 13th, 2024
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.66 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "math"
  6. )
  7.  
  8. func main() {
  9.     var firstTime, secondTime, thirdTime, fatherTime float64
  10.     fmt.Scanln(&firstTime)
  11.     fmt.Scanln(&secondTime)
  12.     fmt.Scanln(&thirdTime)
  13.     fmt.Scanln(&fatherTime)
  14.    
  15.     cleaningTime := 1 / (1 / firstTime + 1 / secondTime + 1 / thirdTime) * 1.15
  16.  
  17.     fmt.Printf("Cleaning time: %.2f\n", cleaningTime)
  18.     if fatherTime > cleaningTime {
  19.         fmt.Printf("Yes, there is a surprise - time left -> %d hours.\n", int(fatherTime - cleaningTime))
  20.     } else {
  21.         fmt.Printf("No, there isn't a surprise - shortage of time -> %d hours.\n", int(math.Ceil(cleaningTime - fatherTime)))
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement