結果

問題 No.327 アルファベット列
ユーザー hkr
提出日時 2017-02-23 02:25:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 57,432 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 19:32:06
合計ジャッジ時間 2,576 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

typedef long long ll;
int main() {
    ll n;
    cin >> n;
    string ans = "";
    int idx = 0;
    while(true) {
        if(idx !=0)
            n--;
        ans += char(n %  26 + 'A');
        n /= 26;
        if(n == 0)
            break;
        idx++;
    }
    for(int i=ans.size()-1;i>=0;i--)
        cout << ans[i];
    cout << endl;
}
0