結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー bal4ubal4u
提出日時 2019-08-19 13:58:32
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 1,078 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 00:16:26
合計ジャッジ時間 2,149 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// 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;
}
0