結果
| 問題 | No.1131 Deviation Score |
| ユーザー |
iiljj
|
| 提出日時 | 2020-10-07 01:12:45 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,872 bytes |
| 記録 | |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 29,824 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-28 03:52:39 |
| 合計ジャッジ時間 | 3,376 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | WA * 13 RE * 8 |
コンパイルメッセージ
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:43:9: note: in expansion of macro 'wt_int_s_'
43 | 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 = 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;
}
iiljj