結果

問題 No.327 アルファベット列
ユーザー kuisiba
提出日時 2016-06-07 20:54:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 60,884 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-08 18:12:42
合計ジャッジ時間 1,710 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <cmath>

using namespace std;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);

    uint64_t n;
    cin >> n;
    int ketaCounter = 1;
    for (uint64_t i = 1; (uint64_t)pow(26, i) <= n; ++i) {
        ketaCounter++;
    }
    for (int j = ketaCounter - 1; j >= 0; --j) {
        if (n >= 26) {
            cout << (char)(n / (uint64_t)pow(26, j) + 64);
        } else {
            cout << (char)(n / (uint64_t)pow(26, j) + 65);
        }
        n -= (n / (uint64_t)pow(26, j)) * (uint64_t)pow(26, j);
    }
    cout << endl;
    return 0;
}
0