Advertisement
ivnikkk

Untitled

Nov 19th, 2022
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include "bits/stdc++.h"
  3. using namespace std;
  4. #define all(a) a.begin(), a.end()
  5. #define int long long
  6. using namespace std;
  7. string get_rom(int x)
  8. {
  9.     string res = "";
  10.     int num[] = { 1,4,5,9,10,40,50,90,100,400,500,900,1000 };
  11.     string sym[] = { "I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M" };
  12.     int i = 12;
  13.     while (x) {
  14.         int div = x / num[i];
  15.         x = x % num[i];
  16.         while (div--) {
  17.             res += sym[i];
  18.         }
  19.         i--;
  20.     }
  21.     return res;
  22. }
  23.  
  24. signed main() {
  25. #ifdef _DEBUG
  26.     freopen("input.txt", "r", stdin);
  27.     freopen("output.txt", "w", stdout);
  28. #endif
  29.     ios_base::sync_with_stdio(false);
  30.     cin.tie(nullptr);
  31.     cout << "?";
  32.     for (int i = 0; i < 100; i++) {
  33.         cout << "]";
  34.     }
  35.     for (int i = 1; i <= 100; i++) {
  36.         string s = to_string(i);
  37.         cout << s[0];
  38.         for (int j = 1; j < (int)s.size(); j++) {
  39.             cout << "#";
  40.         }
  41.         if((int)s.size() > 1) {
  42.             cout << "]";
  43.         }
  44.         else {
  45.             cout << "}";
  46.         }
  47.         for (int k = 1; k < (int)s.size(); k++) {
  48.             cout << s[k];
  49.             for (int j = k + 1; j < (int)s.size(); j++) {
  50.                 cout << "#";
  51.             }
  52.             cout << "+";
  53.             if(k + 1 == (int)s.size()) {
  54.                 cout << "}";
  55.             }
  56.             else {
  57.                 cout << "]";
  58.             }
  59.         }
  60.     }
  61.     char c = '"';
  62.     for (int i = 1; i <= 100; i++) {
  63.         cout << "{";
  64.         cout << "=";
  65.         cout << "(";
  66.         string rm = get_rom(i);
  67.         for (int j = 0; j < (int)rm.size(); j++) {
  68.             cout << rm[j] << ".";
  69.         }
  70.         cout << c;
  71.         cout << ")";
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement