結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー bal4ubal4u
提出日時 2019-08-19 13:26:29
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 30,976 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 23:24:02
合計ジャッジ時間 2,676 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 10 ms
6,944 KB
testcase_06 AC 49 ms
6,944 KB
testcase_07 AC 100 ms
6,944 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 5 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:21:21: note: in expansion of macro 'gc'
   21 |                 c = gc();
      |                     ^~

ソースコード

diff #

// yukicoder: No.667 Mice's Luck(ネズミ達の運)
// bal4u 2019.8.19

#include <stdio.h>

//// 入出力関係
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

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;
	for (i = 0; i < n; i++) {
		printf("%.12lf\n", 100.0*ok / m);
		m--; if (S[i]) ok--;
		if (ok == 0) goto NG;
		else if (ok == m) goto OK; 
	}
	return 0;
NG: while (++i < n) puts(  "0.000000000000"); return 0;
OK: while (++i < n) puts("100.000000000000"); return 0;
}
0