結果

問題 No.327 アルファベット列
ユーザー Mayimg
提出日時 2019-01-04 02:40:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 1,706 ms
コンパイル使用メモリ 169,896 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-23 22:58:21
合計ジャッジ時間 3,462 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);  
	
	long long n;
	cin >> n;
	if(n == 0) {
		puts("A");
		return 0;
	}
	vector<int> num;
	while(n > 0) {
		num.push_back(n % 26);
		n /= 26;
	}
	reverse(num.begin(), num.end());
	for(int i = 0; i < num.size(); i++) {
		if(i < (int) num.size() - 1) {
			cout << (char) ('A' + num[i] - 1);
		} else {
			cout << (char) ('A' + num[i]);
		}
	}
	cout << endl;
	return 0;	
}
0