結果

問題 No.327 アルファベット列
ユーザー femto
提出日時 2016-08-19 18:43:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 78,140 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 18:33:03
合計ジャッジ時間 2,243 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;

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

	ll N;
	cin >> N;

	ll M = 26;
	while(N >= M) {
		if(N % M == 0) {
			while(M) {
				cout << 'A';
				M /= 26;
			}
			cout << 'A' << endl;
			return 0;
		}
		M *= 26;
	}

	if(N == 0) {
		cout << "A" << endl;
		return 0;
	}

	string ans;
	while(N) {
		ans = char('A' + (N % 26)) + ans;
		N /= 26;
	}

	cout << ans << endl;
}
0