Advertisement
Spocoman

10. Profit

Sep 25th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.58 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var oneBGNCoinCount, twoBGNCoinCount, fiveBGNCoinCount, sum int
  7.     fmt.Scanln(&oneBGNCoinCount)
  8.     fmt.Scanln(&twoBGNCoinCount)
  9.     fmt.Scanln(&fiveBGNCoinCount)
  10.     fmt.Scanln(&sum)
  11.    
  12.     for i := 0; i <= oneBGNCoinCount; i++ {
  13.         for j := 0; j <= twoBGNCoinCount; j++ {
  14.             for k := 0; k <= fiveBGNCoinCount; k++ {
  15.                 if i + j * 2 + k * 5 == sum {
  16.                      fmt.Printf("%d * 1 lv. + %d * 2 lv. + %d * 5 lv. = %d lv.\n", i, j, k, sum)
  17.                 }
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement