結果
| 問題 |
No.667 Mice's Luck(ネズミ達の運)
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-08-19 13:58:32 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 1,078 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 30,464 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-04 06:32:21 |
| 合計ジャッジ時間 | 1,816 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.c: In function 'outdbl':
main.c:9:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration]
9 | #define pc(c) putchar_unlocked(c)
| ^~~~~~~~~~~~~~~~
main.c:20:23: note: in expansion of macro 'pc'
20 | if (a == 0) { pc('0'), pc('\n'); return; }
| ^~
main.c: In function 'main':
main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration]
8 | #define gc() getchar_unlocked()
| ^~~~~~~~~~~~~~~~
main.c:43:21: note: in expansion of macro 'gc'
43 | c = gc();
| ^~
ソースコード
// yukicoder: No.667 Mice's Luck(ネズミ達の運)
// bal4u 2019.8.19
#include <stdio.h>
//// 入出力関係
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
#define FLEN 7 // 小数点以下7桁
void outdbl(int a, int b) {
int i, n;
char buf[30];
if (a == 0) { pc('0'), pc('\n'); return; }
n = a/b;
if (n == 0) pc('0');
else {
i = 0; while (n) buf[i++] = n % 10 + '0', n /= 10;
while (i--) pc(buf[i]);
}
a %= b;
if (a) { pc('.'), i = FLEN; while (a && i--) a *= 10, pc('0'+ a/b), a %= b; }
pc('\n');
}
void outs(char *s) { while (*s) pc(*s++); pc('\n'); }
char S[100005];
int main()
{
int i, c, n, m, ok;
ok = 0, n = 0;
for (n = 0; ; n++) {
c = gc();
if (c == 'o') S[n] = 1, ok++;
else if (c < ' ') break;
}
m = n, ok *= 100;
for (i = 0; i < n; i++) {
outdbl(ok, m);
m--; if (S[i]) ok -= 100;
if (ok == 0) goto NG;
else if (ok == m) goto OK;
}
return 0;
NG: while (++i < n) outs( "0"); return 0;
OK: while (++i < n) outs("100"); return 0;
}
bal4u