Advertisement
Spocoman

07. Tennis Ranklist

Sep 21st, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.81 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var tournamentCount, points int
  7.     fmt.Scanln(&tournamentCount)
  8.     fmt.Scanln(&points)
  9.    
  10.     var tournamentPoints = 0
  11.     var win = 0
  12.    
  13.     var currentTournament string
  14.  
  15.     for i := 0; i < tournamentCount; i++ {
  16.         fmt.Scanln(&currentTournament)
  17.        
  18.         switch currentTournament {
  19.             case "W":
  20.                 tournamentPoints += 2000
  21.                 win++
  22.             case "F":
  23.                 tournamentPoints += 1200
  24.             case "SF":
  25.                 tournamentPoints += 720
  26.         }
  27.     }
  28.    
  29.     fmt.Printf("Final points: %d\n", points + tournamentPoints)
  30.     fmt.Printf("Average points: %d\n", tournamentPoints / tournamentCount)
  31.     fmt.Printf("%.2f%%\n", float64(100.0 * win) / float64(tournamentCount))
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement