Advertisement
Spocoman

Ticket Combination

Oct 14th, 2024
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.68 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var n int
  7.     fmt.Scanln(&n)
  8.  
  9.     for a := int('B'); a <= int('L'); a += 2 {
  10.         for b := int('f'); b >= int('a'); b-- {
  11.             for c := int('A'); c <= int('C'); c++ {
  12.                 for d := 1; d <= 10; d++ {
  13.                     for e := 10; e > 0; e-- {
  14.                         n--
  15.                         if n == 0 {
  16.                             fmt.Printf("Ticket combination: %c%c%c%d%d\n", a, b, c, d, e)
  17.                             fmt.Printf("Prize: %d lv.", a + b + c + d + e)
  18.                             return
  19.                         }
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement