結果

問題 No.327 アルファベット列
ユーザー Leonardone
提出日時 2015-12-20 02:35:45
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 22,400 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 11:17:44
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 49 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |     ^~~~~~~~~~~~~~~~~

ソースコード

diff #

/* 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);
}
0