結果
問題 | No.667 Mice's Luck(ネズミ達の運) |
ユーザー |
![]() |
提出日時 | 2019-02-27 00:21:24 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 227 ms / 2,000 ms |
コード長 | 725 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 160,104 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 04:57:19 |
合計ジャッジ時間 | 3,122 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {// 1. 入力情報取得.string S;cin >> S;// 2. 助かる確率は?int o = 0, x = 0;for(int i = 0; i < S.size(); i++){if(S[i] == 'o') o++;else x++;}// 3. 出力 ~ 終了.for(int i = 0; i < S.size(); i++){char c = S[i];// 3-1. ネズミの助かる確率を計算.double ans = 100 * o / (o + x + 0.0);cout << fixed;cout << setprecision(13) << ans << endl;// 3-2. 安全な箱 or ネズミ捕りが仕掛けられた箱 の個数を更新.if(c == 'o') o--;if(c == 'x') x--;}return 0;}