Advertisement
Spocoman

Ticket Combination

Sep 29th, 2023 (edited)
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.  
  9.     for (char a = 'B'; a <= 'L'; a += 2) {
  10.         for (char b = 'f'; b >= 'a'; b--) {
  11.             for (char c = 'A'; c <= 'C'; c++) {
  12.                 for (int d = 1; d <= 10; d++) {
  13.                     for (int e = 10; e > 0; e--) {
  14.                         if (--n == 0) {
  15.                             cout << "Ticket combination: " << a << b << c << d << e << endl
  16.                                 << "Prize: " << a + b + c + d + e << " lv.\n";
  17.                             return 0;
  18.                         }
  19.                     }
  20.                 }
  21.             }
  22.         }
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement