#include #include #include using namespace std; typedef unsigned long long uint64; int main() { const char alp[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; uint64 dec; int digits; list out; cin >> dec; if (dec < 26) { out.push_front(alp[dec % 26]); } else { for (digits = 1; dec >= 26 * ((uint64) pow(26, digits) - 1) / 25; digits++); do { if (digits == 1) { out.push_front(alp[dec % 27 - 1]); } else { out.push_front(alp[dec % 26]); } dec /= 26; } while (--digits > 0); } list::iterator it = out.begin(); while (it != out.end()) { cout << *it; ++it; } cout << endl; return 0; }