結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー pumbaacavepumbaacave
提出日時 2020-09-13 16:52:38
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 705 bytes
コンパイル時間 3,899 ms
コンパイル使用メモリ 92,160 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 21:45:34
合計ジャッジ時間 4,078 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>

using namespace std;

#define ll long long
#define all(v) v.begin(),v.end()
#define bootstrap ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);


void solve() {
    string boxes;
    cin >> boxes;
    double o, x = 0;
    for (char &ch:boxes) {
        if (ch == 'x') {
            x++;
        }
    }
    o = boxes.length() - x;
    cout.precision(10);
    for (int i = 0; i < boxes.length(); ++i) {
        cout << 100 * o / (x + o) << endl;
        if(boxes.at(i) == 'o') {
            o --;
        } else {
            x --;
        }
    }

}

int main() {
    bootstrap;
    solve();
}
0