結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー hkarintohkarinto
提出日時 2018-06-10 16:42:25
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 501 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 68,604 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 02:39:55
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:6: warning: ‘s’ is used uninitialized in this function [-Wuninitialized]
 cin>>s;
      ^

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
   int n=10000;
   char *s;
cin>>s;


n=int(sizeof(s)-1);


for(int i=0;i<n;i++){
   
    int count=100;
    int surv =0;
    for(int j=i;j<n;j++){

        if(s[j]=='o'){
           
            surv +=1;
        }
    }
    count=n-i;
    if(count==0){
    return 0;
    }
    float ans =1.0*surv/count;
    cout<<fixed << setprecision(10)<<ans<<"\n";
}

    return 0;
}
0