結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー IchimiyaIchimiya
提出日時 2020-07-14 21:36:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 167,312 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 15:35:16
合計ジャッジ時間 4,414 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 26 ms
5,376 KB
testcase_06 AC 120 ms
5,376 KB
testcase_07 AC 236 ms
5,376 KB
testcase_08 AC 188 ms
5,376 KB
testcase_09 AC 176 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	string S;
	cin >> S;

	int circle, cross, sum;
	double ans;
	circle = 0;
	cross = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S.at(i) == 'o') circle++;
		else cross++;
	}

	for (int i = 0; i < S.size(); i++) {
		sum = circle + cross;
		ans = (double)circle / sum;
		cout << fixed << setprecision(10) << ans * 100 << endl;

		if (S.at(i) == 'o') circle--;
		else cross--;
	}
}
0