結果

問題 No.667 Mice's Luck(ネズミ達の運)
コンテスト
ユーザー bal4u
提出日時 2019-08-19 13:53:39
言語 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
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 1,079 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 336 ms
コンパイル使用メモリ 39,652 KB
最終ジャッジ日時 2026-02-22 04:22:43
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// 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 12   // 小数点以下12桁
void outdbl(int a, int b) {
	int i, n;
	char buf[30];
	double y;
	
	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;
	for (i = 0; i < n; i++) {
		outdbl(100*ok, m);
		m--; if (S[i]) ok--;
		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;
}
0