結果

問題 No.327 アルファベット列
ユーザー Mister
提出日時 2020-04-13 22:24:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 71,612 KB
最終ジャッジ日時 2025-01-09 18:15:12
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>

using lint = long long;

void solve() {
    lint n;
    std::cin >> n;

    int len = 1;
    lint pat = 26;
    while (n >= pat) {
        n -= pat;
        pat *= 26;
        ++len;
    }

    std::string s;
    while (len--) {
        s.push_back(n % 26 + 'A');
        n /= 26;
    }

    std::reverse(s.begin(), s.end());
    std::cout << s << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0