Advertisement
Spocoman

Gymnastics

Oct 10th, 2024 (edited)
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 2.67 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var country, device string
  7.     fmt.Scanln(&country)
  8.     fmt.Scanln(&device)
  9.    
  10.     difficulty := 0.0
  11.     performance := 0.0
  12.  
  13.     if country == "Russia" {
  14.         if device == "ribbon" {
  15.             difficulty = 9.100
  16.             performance = 9.400
  17.         } else if device == "hoop" {
  18.             difficulty = 9.300
  19.             performance = 9.800
  20.         } else if device == "rope" {
  21.             difficulty = 9.600
  22.             performance = 9.000
  23.         }
  24.     } else if country == "Bulgaria" {
  25.         if device == "ribbon" {
  26.             difficulty = 9.600
  27.             performance = 9.400
  28.         } else if device == "hoop" {
  29.             difficulty = 9.550
  30.             performance = 9.750
  31.         } else if device == "rope" {
  32.             difficulty = 9.500
  33.             performance = 9.400
  34.         }
  35.     } else if country == "Italy" {
  36.         if device == "ribbon" {
  37.             difficulty = 9.200
  38.             performance = 9.500
  39.         } else if device == "hoop" {
  40.             difficulty = 9.450
  41.             performance = 9.350
  42.         } else if device == "rope" {
  43.             difficulty = 9.700
  44.             performance = 9.150
  45.         }
  46.     }
  47.  
  48.     score := difficulty + performance
  49.  
  50.     fmt.Printf("The team of %s get %.3f on %s.\n%.2f%%\n", country, score, device, (20 - score) * 5)
  51. }
  52.  
  53. ИЛИ:
  54.  
  55. package main
  56.  
  57. import "fmt"
  58.  
  59. func main() {
  60.     var country, device string
  61.     fmt.Scanln(&country)
  62.     fmt.Scanln(&device)
  63.    
  64.     difficulty := 0.0
  65.     performance := 0.0
  66.  
  67.     switch country {
  68.     case "Russia":
  69.         switch device {
  70.         case "ribbon":
  71.             difficulty = 9.100
  72.             performance = 9.400
  73.         case "hoop":
  74.             difficulty = 9.300
  75.             performance = 9.800
  76.         case "rope":
  77.             difficulty = 9.600
  78.             performance = 9.000
  79.         }
  80.     case "Bulgaria":
  81.         switch device {
  82.         case "ribbon":
  83.             difficulty = 9.600
  84.             performance = 9.400
  85.         case "hoop":
  86.             difficulty = 9.550
  87.             performance = 9.750
  88.         case "rope":
  89.             difficulty = 9.500
  90.             performance = 9.400
  91.         }
  92.     case "Italy":
  93.         switch device {
  94.         case "ribbon":
  95.             difficulty = 9.200
  96.             performance = 9.500
  97.         case "hoop":
  98.             difficulty = 9.450
  99.             performance = 9.350
  100.         case "rope":
  101.             difficulty = 9.700
  102.             performance = 9.150
  103.         }
  104.     }
  105.  
  106.     score := difficulty + performance
  107.  
  108.     fmt.Printf("The team of %s get %.3f on %s.\n%.2f%%\n", country, score, device, (20 - score) * 5)
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement