結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー hkarintohkarinto
提出日時 2018-06-10 17:56:07
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 738 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 68,500 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 02:42:07
合計ジャッジ時間 2,366 ms
ジャッジサーバーID
(参考情報)
judge15 / 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:12: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;

int N=0;
for(int i=0;i<n;i++){
    if(s[i]=='\0'){
    break;
    }
    N+=1;
}
n=N;

int *x;
x= new int[n];



if(s[n-1]=='o'){
    x[n-1]=1;
}else{
    x[n-1]=0;
}

for (int i=n-2;i>=0;i--){
    x[i]=x[i+1];
   if(s[i]=='o'){
       x[i]+=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;
    }
    double ans =100.0*surv/count;
    cout<<fixed << setprecision(13)<<ans<<"\n";
}
/**/
    return 0;
}
0