結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー 12uguisu12uguisu
提出日時 2018-03-24 00:31:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 62,240 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 07:32:41
合計ジャッジ時間 3,156 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 13 ms
4,376 KB
testcase_06 AC 58 ms
4,376 KB
testcase_07 AC 115 ms
4,376 KB
testcase_08 AC 62 ms
4,376 KB
testcase_09 AC 52 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
using namespace std;

int main(){
	double d;
	double safe = 0.0;
	double den = 0.0;
	string s;
	
	cin>>s;

	int size = s.size();

	for(int i = 0; i < size; i++){
		if(s[i] == 'o') safe += 1.0;
		if(s[i] == 'x') den += 1.0;
	}

	for(int i = 0; i < size; i++){
		d = (safe / (safe+den)) * 100.00;
        cout<<fixed;
		cout<<setprecision(12)<<d<<"\n";
		if(s[i] == 'o') safe-=1.0;
		if(s[i] == 'x') den-=1.0;
	}

	return 0;

}
0