結果
| 問題 |
No.425 ジャンケンの必勝法
|
| コンテスト | |
| ユーザー |
HO_RI1991
|
| 提出日時 | 2016-09-23 00:05:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 856 bytes |
| コンパイル時間 | 701 ms |
| コンパイル使用メモリ | 92,128 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 19:43:38 |
| 合計ジャッジ時間 | 1,509 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 18 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<typeinfo>
using namespace std;
const double pi=4*atan(1.0);
constexpr long long mod=static_cast<long long>(1e9+7);
using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;
int main() {
int p,q;
cin>>p>>q;
vector<double> dp1(101,0);
vector<double> dp2(101,0);
int cnt=0;
while(1){
for(int i=0;i<101;++i){
dp1[i]=double(i)*(1.+dp1[max(0,i-q)])/200.+(100.-double(i))*(1+dp1[min(100,i+q)])/300.;
}
++cnt;
if(cnt>10000)break;
}
cout<<fixed<<setprecision(10)<<dp1[p]/3.+1./3.<<endl;
//system("pause");
return 0;
}
HO_RI1991