Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var days, winTotal, loseTotal int
- fmt.Scanln(&days)
- totalSum := 0.0
- var command string
- for i := 0; i < days; i++ {
- var win, lose int
- sum := 0.0
- for {
- fmt.Scanln(&command)
- if command == "win" {
- sum += 20
- win++
- } else if command == "lose" {
- lose++
- } else if command == "Finish" {
- if win > lose {
- totalSum += sum * 1.1
- winTotal += win
- } else {
- totalSum += sum
- loseTotal += lose
- }
- break
- }
- }
- }
- if winTotal > loseTotal {
- fmt.Printf("You won the tournament! Total raised money: %.2f\n", totalSum * 1.2)
- } else {
- fmt.Printf("You lost the tournament! Total raised money: %.2f\n", totalSum)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement