結果

問題 No.327 アルファベット列
コンテスト
ユーザー airuai
提出日時 2016-09-22 02:12:12
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 640 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 586 ms
コンパイル使用メモリ 79,880 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-12 08:48:25
合計ジャッジ時間 2,501 ms
ジャッジサーバーID
(参考情報)
tmp-judge_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#define pr(s) std::cout << s << std::endl
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long n;
	cin >> n;
	vector<char> c;
	vector<char>::iterator it = c.begin();
	c.insert(it, n % 26 + 'A');
	it = c.begin();
	n /= 26;
	int t;
	bool f = false;;
	while (n) {
		if ((t = n % 26) == 0) {
			c.insert(it, 'Z');
		}
		else {
			if (*(it) == 'Z') {
				if (t > 1) {
					c.insert(it, t + 'A' - 2);
				}
			}
			else {
				c.insert(it, t + 'A' - 1);
			}
		}
		it = c.begin();
		n /= 26;
		f = true;
	}
	while (it != c.end()) {
		cout << *it;
		++it;
	}
	cout << endl;
}
0