結果

問題 No.327 アルファベット列
ユーザー otsnsk
提出日時 2015-12-23 20:45:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 864 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 64,380 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 21:46:15
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define FORR(i,b,e) for(int i=(b);i<(int)(e);++i)
#define FOR(i,e) FORR(i,0,e)
#define ALL(c) begin(c), end(c)
#define dump(var) cerr << #var ": " << var << "\n"
#define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n"

using namespace std;

typedef long long ll;

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

    const int base = 26;
    ll N;
    cin >> N;
    string alpha_n = "";
    if (N < base) {
        cout << (char)('A' + N) << endl;
    }
    else {
        while (N > 0) {
            if (N < base) {
                alpha_n.insert(0, 1, 'A' + N % base - 1);
            }
            else {
                alpha_n.insert(0, 1, 'A' + N % base);
            }
            N /= base;
        }
        cout << alpha_n << endl;
    }
    return 0;
}
0