結果
問題 | No.667 Mice's Luck(ネズミ達の運) |
ユーザー |
![]() |
提出日時 | 2018-03-25 14:41:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 131 ms / 2,000 ms |
コード長 | 601 bytes |
コンパイル時間 | 528 ms |
コンパイル使用メモリ | 55,928 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 05:56:21 |
合計ジャッジ時間 | 2,546 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include<stdio.h> #include<iostream> using namespace std; int main (){ string s; cin >> s; double safe=0,out=0; for(int i=0; i<s.length(); i++){ if( s[i] == 'o' ) safe++; if( s[i] == 'x' ) out++; } for(int i=0; i<s.length(); i++){ if( safe < 1 ) { cout << 0 << endl; } else if ( out < 1 ) { cout << 100 << endl; } else { double p = safe * 100 / (safe + out); printf("%.10f\n", p); if( s[i] == 'o' ) safe--; if( s[i] == 'x' ) out--; } } return 0; }