結果
| 問題 |
No.327 アルファベット列
|
| コンテスト | |
| ユーザー |
MJDigit
|
| 提出日時 | 2015-12-26 01:24:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 883 bytes |
| コンパイル時間 | 1,236 ms |
| コンパイル使用メモリ | 62,576 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 00:07:43 |
| 合計ジャッジ時間 | 2,379 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 47 |
ソースコード
#include <iostream>
#include <cmath>
#include <list>
using namespace std;
typedef unsigned long long uint64;
int main() {
const char alp[] =
{'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'};
uint64 dec;
int digits;
list<char> out;
cin >> dec;
if (dec < 26) {
out.push_front(alp[dec % 26]);
} else {
for (digits = 1; dec >= 26 * ((uint64) pow(26, digits) - 1) / 25; digits++);
do {
if (digits == 1) {
out.push_front(alp[dec % 27 - 1]);
} else {
out.push_front(alp[dec % 26]);
}
dec /= 26;
} while (--digits > 0);
}
list<char>::iterator it = out.begin();
while (it != out.end()) {
cout << *it;
++it;
}
cout << endl;
return 0;
}
MJDigit