結果

問題 No.1131 Deviation Score
ユーザー iiljj
提出日時 2020-10-07 01:04:15
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,783 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 165 ms
コンパイル使用メモリ 39,244 KB
最終ジャッジ日時 2026-02-22 06:09:30
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 10 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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 = 50 - (s - x[i] * n) / (2 * n);
        wt_int_s_(a, buf, ptr, sign);
        putc_unlocked('\n', stdout);
    }

    return 0;
}
0