結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-09-28 22:42:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 721 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 65,208 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 07:33:24
合計ジャッジ時間 1,012 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

int P, C;
int p[6] = {2, 3, 5, 7, 11, 13};
int c[6] = {4, 6, 8, 9, 10, 12};
ll ans = 0;

int main(void){
	cin >> P >> C;
	// ep:=サイコロpの時の出る目の期待値 ec:=サイコロcの時の出る目の期待値
	double ep = 0, ec = 0;
	rep(i, 6) ep += p[i];
	ep /= 6.0;
	rep(i, 6) ec += c[i];
	ec /= 6.0;
	//確率変数XとYが独立であるときは、確率変数XYの期待値は E(XY) = E(X)E(Y);
	double E = 1.0;
	rep(i, P) E *= ep;
	rep(i, C) E *= ec;
	printf("%.10f\n", E);
	return 0;
}
0