結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー Konton7
提出日時 2020-01-13 17:13:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 166,848 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-18 00:45:36
合計ジャッジ時間 3,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
    int n, c, d;
  	double p;
    string s;
  	cin >> s;
    n = s.size();
    c = 0, d = 0;
    for (int i = 0; i < n; i++){
        if (s[i] == 'o')
            c++;
        else
            d++;
    }
    for (int i = 0; i < n; i++){
      	p = (c*100.0)/(c+d);
        printf("%6f\n", p);
        if (s[i] == 'o')
            c--;
        else
            d--;
    }
    return 0;
}
0