結果
問題 |
No.327 アルファベット列
|
ユーザー |
|
提出日時 | 2015-12-20 02:36:57 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-06 21:15:41 |
合計ジャッジ時間 | 1,352 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); n++; do { *(--p) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[(int)(((n - s) % d2) / d1)]; d1 = d2; d2 *= 26LL; s += d1; } while (s <= n); puts(p); }