結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー IchimiyaIchimiya
提出日時 2020-07-14 21:36:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 165,096 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-12 00:31:10
合計ジャッジ時間 5,008 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 24 ms
4,380 KB
testcase_06 AC 117 ms
4,380 KB
testcase_07 AC 229 ms
4,384 KB
testcase_08 AC 185 ms
4,384 KB
testcase_09 AC 172 ms
4,380 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