結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー hotpepsi
提出日時 2015-05-24 00:37:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 60,868 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 06:23:37
合計ジャッジ時間 967 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[])
{
	cout.precision(16);
	int a[2][6] = {
		{ 2, 3, 5, 7, 11, 13 },
		{ 4, 6, 8, 9, 10, 12 }
	};
	int s1 = accumulate(a[0], a[0] + 6, 0);
	int s2 = accumulate(a[1], a[1] + 6, 0);
	string s;
	getline(cin, s);
	stringstream ss(s);
	int P, C;
	ss >> P >> C;
	long double ans = 1.0;
	for (int i = 0; i < P; ++i) {
		ans *= (s1 / 6.0);
	}
	for (int i = 0; i < C; ++i) {
		ans *= (s2 / 6.0);
	}
	cout << ans << endl;
	return 0;
}
0