結果

問題 No.327 アルファベット列
ユーザー 情報学生
提出日時 2019-09-25 01:31:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 172,988 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 14:56:17
合計ジャッジ時間 2,782 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
const std::vector<std::string> alphabet = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
std::vector<std::string> d;
void solve(long long n) {
    while (n >= 26) {
        d.push_back(alphabet[n%26]);
        n = (n / 26) - 1;
    }
    d.push_back(alphabet[n%26]);
    int N = static_cast<int>(d.size());
    for (int i = N-1; i >= 0; i--) {
    	std::cout << d[i];
    }
    
} 

void No327() {
    using namespace std;
    long long N; cin >> N;
    solve(N);
    cout << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    std::cerr << std::fixed << std::setprecision(10);
    No327();
    return 0;
}
0