結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー odan3240odan3240
提出日時 2015-12-27 19:55:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 971 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 87,944 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 11:22:43
合計ジャッジ時間 1,411 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef long long ll;

int dice1[] = {2,3,5,7,11,13};
int dice2[] = {4,6,8,9,10,12};
int P,Q;
double dfs(int cnt,int dice[],int n) {
    if(cnt==n) return 1;
    double ret = 0;
    rep(i,6) ret += dfs(cnt+1, dice, n)*dice[i]/6.0;

    return ret;
}
int main() {
    cin>>P>>Q;
    double ans = dfs(0,dice1,P);
    ans*=dfs(0,dice2,Q);
    printf("%.12f\n",ans);
    return 0;
}
0