Advertisement
Spocoman

06. Trekking Mania

Sep 21st, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.02 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var groupNumbers, group int
  7.     fmt.Scanln(&groupNumbers)
  8.    
  9.     var musala = 0
  10.     var montBlanc = 0
  11.     var kilimanjaro = 0
  12.     var k2 = 0
  13.     var everest = 0
  14.     var alpinistSum = 0
  15.  
  16.     for i := 0; i < groupNumbers; i++ {
  17.         fmt.Scanln(&group)
  18.         alpinistSum += group
  19.         if group > 40 {
  20.             everest += group
  21.         } else if group > 25 {
  22.             k2 += group
  23.         } else if group > 12 {
  24.             kilimanjaro += group
  25.         } else if group > 5 {
  26.             montBlanc += group
  27.         } else if group > 0 {
  28.             musala += group
  29.         }
  30.     }
  31.  
  32.     fmt.Printf("%.2f%%\n", float64(100 * musala) / float64(alpinistSum))
  33.     fmt.Printf("%.2f%%\n", float64(100 * montBlanc) / float64(alpinistSum))
  34.     fmt.Printf("%.2f%%\n", float64(100 * kilimanjaro) / float64(alpinistSum))
  35.     fmt.Printf("%.2f%%\n", float64(100 * k2) / float64(alpinistSum))
  36.     fmt.Printf("%.2f%%\n", float64(100 * everest) / float64(alpinistSum))
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement