結果
問題 |
No.667 Mice's Luck(ネズミ達の運)
|
ユーザー |
![]() |
提出日時 | 2018-06-10 16:42:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 507 ms |
コンパイル使用メモリ | 68,228 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 13:17:10 |
合計ジャッジ時間 | 2,630 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:6: warning: ‘s’ is used uninitialized [-Wuninitialized] 11 | cin>>s; | ^
ソースコード
#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; }