Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var country, device string
- fmt.Scanln(&country)
- fmt.Scanln(&device)
- difficulty := 0.0
- performance := 0.0
- if country == "Russia" {
- if device == "ribbon" {
- difficulty = 9.100
- performance = 9.400
- } else if device == "hoop" {
- difficulty = 9.300
- performance = 9.800
- } else if device == "rope" {
- difficulty = 9.600
- performance = 9.000
- }
- } else if country == "Bulgaria" {
- if device == "ribbon" {
- difficulty = 9.600
- performance = 9.400
- } else if device == "hoop" {
- difficulty = 9.550
- performance = 9.750
- } else if device == "rope" {
- difficulty = 9.500
- performance = 9.400
- }
- } else if country == "Italy" {
- if device == "ribbon" {
- difficulty = 9.200
- performance = 9.500
- } else if device == "hoop" {
- difficulty = 9.450
- performance = 9.350
- } else if device == "rope" {
- difficulty = 9.700
- performance = 9.150
- }
- }
- score := difficulty + performance
- fmt.Printf("The team of %s get %.3f on %s.\n%.2f%%\n", country, score, device, (20 - score) * 5)
- }
- ИЛИ:
- package main
- import "fmt"
- func main() {
- var country, device string
- fmt.Scanln(&country)
- fmt.Scanln(&device)
- difficulty := 0.0
- performance := 0.0
- switch country {
- case "Russia":
- switch device {
- case "ribbon":
- difficulty = 9.100
- performance = 9.400
- case "hoop":
- difficulty = 9.300
- performance = 9.800
- case "rope":
- difficulty = 9.600
- performance = 9.000
- }
- case "Bulgaria":
- switch device {
- case "ribbon":
- difficulty = 9.600
- performance = 9.400
- case "hoop":
- difficulty = 9.550
- performance = 9.750
- case "rope":
- difficulty = 9.500
- performance = 9.400
- }
- case "Italy":
- switch device {
- case "ribbon":
- difficulty = 9.200
- performance = 9.500
- case "hoop":
- difficulty = 9.450
- performance = 9.350
- case "rope":
- difficulty = 9.700
- performance = 9.150
- }
- }
- score := difficulty + performance
- fmt.Printf("The team of %s get %.3f on %s.\n%.2f%%\n", country, score, device, (20 - score) * 5)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement