Naxocist

AscII Art

Apr 29th, 2023
1,574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | Source Code | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. using ll = long long int;
  4. void solve() {
  5.    
  6.     ll x; cin >> x;
  7.     x--;
  8.     int i = 1;
  9.     while(x >= 26*i) {
  10.         x -= 26*i;
  11.         i++;
  12.     }
  13.  
  14.     cout << char('A' + x/i) << '\n';
  15. }
  16.  
  17. int main() {
  18.     int q; cin >> q;
  19.     for(int i=1; i<=q; ++i) {
  20.         cout << "Case #" << i << ": ";
  21.         solve();
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment