結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー btkbtk
提出日時 2015-05-22 22:28:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,076 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 83,684 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 09:27:27
合計ジャッジ時間 1,730 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
using namespace std;


#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line  getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num

double t[] = { 2, 3, 5, 7, 11, 13 };
double s[] = { 4, 6, 8, 9, 10, 12 };

int p, c;
double e = 0;
void func1(double val,int n){
	if (n == c){
		e += val;
		return;
	}
	for (int i = 0; i < 6; i++){
		func1(val*(s[i] / 6.0), n + 1);
	}
}
void func2(double val,int n){
	if (n == p){
		func1(val, 0);
		return;
	}
	for (int i = 0; i < 6; i++){
		func2(val*(t[i]/6.0),n+1);
	}
}
int main(void){
	cin >> p >> c;
	func2(1, 0);
	printf("%.10f\n");
	return(0);
}
0