結果
| 問題 |
No.425 ジャンケンの必勝法
|
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2016-09-22 15:10:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 801 bytes |
| コンパイル時間 | 1,573 ms |
| コンパイル使用メモリ | 169,616 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 19:06:13 |
| 合計ジャッジ時間 | 2,367 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
struct cww{
cww(){
ios::sync_with_stdio(false);cin.tie(0);
cout<<fixed<<setprecision(20);
}
}init;
typedef __float128 D;
typedef vector<D> VD;
ostream& operator<<(ostream &os,__float128 f){
os<<(double)f;
return os;
}
istream& operator>>(istream &is,__float128 &f){
double x;
is>>x;f=x;
return is;
}
const D d2=200;
const D d3=300;
const int loop=100;
int main(){
int p,q;
cin>>p>>q;
assert(0<=p&&p<=100);
assert(0<=q&&q<=100);
D res=0;
VD P(101,0);
for(int i=0;i<loop;i++){
VD Q(101);
for(int j=0;j<=100;j++)
Q[j]=(j/d2)*(1+P[max(j-q,0)])+((100-j)/d3)*(1+P[min(j+q,100)]);
swap(P,Q);
}
cout<<1.0/3+P[p]/3.0<<endl;
return 0;
}
btk