Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- team := scanner.Text()
- scanner.Scan()
- matchCount,_ := strconv.Atoi(scanner.Text())
- var won, drawn, lost int
- for i := 0; i < matchCount; i++ {
- scanner.Scan()
- result := scanner.Text()
- if result == "W" {
- won++
- } else if result == "D" {
- drawn++
- } else {
- lost++
- }
- }
- if matchCount == 0 {
- fmt.Printf("%s hasn't played any games during this season.\n", team)
- } else {
- fmt.Printf("%s has won %d points during this season.\nTotal stats:\n## W: %d\n## D: %d\n## L: %d\nWin rate: %.2f%%\n",
- team, won * 3 + drawn, won, drawn, lost, float64(won) / float64(matchCount) * 100)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement