結果

問題 No.425 ジャンケンの必勝法
ユーザー HO_RI1991HO_RI1991
提出日時 2016-09-23 00:05:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 1,035 ms
コンパイル使用メモリ 92,608 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 05:57:37
合計ジャッジ時間 2,270 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 5 ms
4,376 KB
testcase_02 AC 5 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 6 ms
4,380 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 12 ms
4,380 KB
testcase_12 AC 13 ms
4,376 KB
testcase_13 AC 13 ms
4,380 KB
testcase_14 AC 13 ms
4,376 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 12 ms
4,380 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 13 ms
4,380 KB
testcase_21 AC 6 ms
4,384 KB
testcase_22 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0