結果
| 問題 |
No.327 アルファベット列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-20 02:30:27 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 585 bytes |
| コンパイル時間 | 164 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 21:14:26 |
| 合計ジャッジ時間 | 1,343 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 |
コンパイルメッセージ
main.c: In function ‘solve’:
main.c:20:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | scanf("%lld", &n);
| ^~~~~~~~~~~~~~~~~
ソースコード
/* yukicoder My Practice
* autoher: Leonarone NEETSDKASU
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
typedef long long ll;
typedef unsigned long long ull;
void solve(void);
int main(void) { solve(); return 0; }
void solve(void) {
char ans[21] = {0}, *p = &ans[20];
ll n, s = -1LL, d1 = 1LL, d2 = 26LL;
scanf("%lld", &n);
for (;;) {
s += d1;
if (s > n) break;
*(--p) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[(int)(((n - s) % d2) / d1)];
d1 = d2;
d2 *= 26LL;
}
puts(p);
}