結果
問題 |
No.327 アルファベット列
|
ユーザー |
|
提出日時 | 2016-01-22 14:51:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 690 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 47,728 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-21 14:59:40 |
合計ジャッジ時間 | 1,724 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 31 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <memory.h> #include <string> #include <algorithm> const char ABC[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const int SIZE = (sizeof(ABC) - 1); int input_num() { int n = 0; char buff[256]; if (fgets(buff, sizeof(buff), stdin) != 0) { n = atoi(buff); } return n; } const char *calc(const int N, std::string &buff) { int n = N + 1; do { n -= 1; buff += ABC[n % SIZE]; n /= SIZE; } while (n != 0); std::reverse(buff.begin(), buff.end()); return buff.c_str(); } int main() { const int N = input_num(); std::string buff; printf("%s\n", calc(N, buff)); return 0; }