結果

問題 No.327 アルファベット列
ユーザー springroll
提出日時 2018-11-19 13:51:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 168,852 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-24 15:16:22
合計ジャッジ時間 3,429 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

string AtoZ;

int main() {
    ll N;
    cin >> N;
    list<char> lst;
    for(char ch='A'; ch<='Z'; ch++){
        AtoZ.push_back(ch);
    }
    ll cnt=0;
    while(1){
        ll x;
        x = N%26;
        N /= 26;
        if(cnt++==0) lst.push_front(AtoZ[x]);
        else lst.push_front(AtoZ[x-1]);
        //cout << N <<" "<< x << endl;
        if(N==1){
            lst.push_front('A');
            break;
        }
        if(N==0) break;
    }

    for(auto itr=lst.begin(); itr!=lst.end(); itr++){
        cout << *itr;
    }
    cout << endl;
}
0