結果

問題 No.1128 Wedding Ceremony
ユーザー iiljjiiljj
提出日時 2020-10-07 00:08:40
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 1,518 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 28,504 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 09:00:32
合計ジャッジ時間 2,226 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,376 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 0 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 0 ms
4,376 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:6:15: 警告: 関数 ‘getc_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    6 |         tmp = getc_unlocked(stdin);                                                                                    \
      |               ^~~~~~~~~~~~~
main.c:23:5: 備考: in expansion of macro ‘rd_int’
   23 |     rd_int(n, k);
      |     ^~~~~~
main.c:17:19: 警告: 関数 ‘putc_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   17 |     while (ptr--) putc_unlocked(buf[ptr] + '0', stdout);
      |                   ^~~~~~~~~~~~~
main.c:25:5: 備考: in expansion of macro ‘wt_int’
   25 |     wt_int(n, buf, ptr);
      |     ^~~~~~

ソースコード

diff #

#include <stdio.h>

// int tmp, var = 0; を先に宣言する
#define rd_int(var, tmp)                                                                                               \
    for (;;) {                                                                                                         \
        tmp = getc_unlocked(stdin);                                                                                    \
        if (tmp < '0' || tmp > '9') break;                                                                             \
        var = var * 10 + tmp - '0';                                                                                    \
    }

// char buf[9]; int ptr = 0; を先に宣言する
#define wt_int(var, buf, ptr)                                                                                          \
    while (var) {                                                                                                      \
        buf[ptr++] = var % 10;                                                                                         \
        var /= 10;                                                                                                     \
    }                                                                                                                  \
    while (ptr--) putc_unlocked(buf[ptr] + '0', stdout);

int main() {
    int k, n = 0, ptr = 0;
    char buf[9];

    rd_int(n, k);
    n |= 1;
    wt_int(n, buf, ptr);

    return 0;
}
0