結果
| 問題 | No.667 Mice's Luck(ネズミ達の運) |
| コンテスト | |
| ユーザー |
hkarinto
|
| 提出日時 | 2018-06-10 17:48:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 548 ms |
| コンパイル使用メモリ | 68,744 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 13:17:30 |
| 合計ジャッジ時間 | 2,604 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:6: warning: ‘s’ is used uninitialized [-Wuninitialized]
12 | cin>>s;
| ^
ソースコード
#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];
for (int i=0;i<n;i++){
x[i]=0;
}
if(s[n-1]=='o'){
x[n-1]=1;
}
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;
}
float ans =1.0*surv/count;
cout<<fixed << setprecision(10)<<ans<<"\n";
}
/**/
return 0;
}
hkarinto