結果
問題 |
No.1131 Deviation Score
|
ユーザー |
![]() |
提出日時 | 2020-10-07 01:04:15 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,783 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 29,440 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:10:43 |
合計ジャッジ時間 | 3,441 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | WA * 7 RE * 14 |
コンパイルメッセージ
main.c: In function 'main': main.c:6:15: warning: implicit declaration of function 'getc_unlocked' [-Wimplicit-function-declaration] 6 | tmp = getc_unlocked(stdin); \ | ^~~~~~~~~~~~~ main.c:33:5: note: in expansion of macro 'rd_int' 33 | rd_int(n, tmp); | ^~~~~~ main.c:22:15: warning: implicit declaration of function 'putc_unlocked' [-Wimplicit-function-declaration] 22 | if (sign) putc_unlocked('-', stdout); \ | ^~~~~~~~~~~~~ main.c:27:5: note: in expansion of macro 'wt_int_s' 27 | wt_int_s(var, buf, ptr, sign); | ^~~~~~~~ main.c:42:9: note: in expansion of macro 'wt_int_s_' 42 | wt_int_s_(a, buf, ptr, sign); | ^~~~~~~~~
ソースコード
#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; }