Advertisement
Spocoman

06. World Swimming Record

Sep 16th, 2024
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.48 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var record, distance, secondsToMeter float64
  6.     fmt.Scanln(&record)
  7.     fmt.Scanln(&distance)
  8.     fmt.Scanln(&secondsToMeter)
  9.    
  10.     var score = distance * secondsToMeter + float64(int(distance / 15)) * 12.5
  11.  
  12.     if (score >= record) {
  13.         fmt.Printf("No, he failed! He was %.2f seconds slower.", score - record)
  14.     } else {
  15.         fmt.Printf("Yes, he succeeded! The new world record is %.2f seconds.", score)
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement