結果

問題 No.1131 Deviation Score
ユーザー iiljjiiljj
提出日時 2020-10-07 01:12:45
言語 C
(gcc 12.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 2,872 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 29,032 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-10 12:32:23
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:6:15: 警告: 関数 ‘getc_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    6 |         tmp = getc_unlocked(stdin);                                                                                    \
      |               ^~~~~~~~~~~~~
main.c:33:5: 備考: in expansion of macro ‘rd_int’
   33 |     rd_int(n, tmp);
      |     ^~~~~~
main.c:22:15: 警告: 関数 ‘putc_unlocked’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   22 |     if (sign) putc_unlocked('-', stdout);                                                                              \
      |               ^~~~~~~~~~~~~
main.c:27:5: 備考: in expansion of macro ‘wt_int_s’
   27 |     wt_int_s(var, buf, ptr, sign);
      |     ^~~~~~~~
main.c:43:9: 備考: in expansion of macro ‘wt_int_s_’
   43 |         wt_int_s_(a, buf, ptr, sign);
      |         ^~~~~~~~~

ソースコード

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, sign = 0; を先に宣言する
#define wt_int_s(var, buf, ptr, sign)                                                                                  \
    if (var < 0) {                                                                                                     \
        sign = 1;                                                                                                      \
        var = -var;                                                                                                    \
    }                                                                                                                  \
    while (var) {                                                                                                      \
        buf[ptr++] = var % 10;                                                                                         \
        var /= 10;                                                                                                     \
    }                                                                                                                  \
    if (!ptr) buf[ptr++] = 0;                                                                                          \
    if (sign) putc_unlocked('-', stdout);                                                                              \
    while (ptr--) putc_unlocked(buf[ptr] + '0', stdout);

#define wt_int_s_(var, buf, ptr, sign)                                                                                 \
    ptr = sign = 0;                                                                                                    \
    wt_int_s(var, buf, ptr, sign);

int main() {
    int n, s = 0, ptr, sign, tmp, x[100000];
    char buf[10];

    rd_int(n, tmp);
    for (int i = 0; i < n; ++i) {
        x[i] = 0;
        rd_int(x[i], tmp);
        s += x[i];
    }

    for (int i = 0; i < n; ++i) {
        // 府の除算の切り捨てを考慮する!
        int a = 100 + 50 - (s - x[i] * n + 2 * n - 1 + 2 * n * 100) / (2 * n);
        wt_int_s_(a, buf, ptr, sign);
        putc_unlocked('\n', stdout);
    }

    return 0;
}
0