結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー TLwiegehttTLwiegehtt
提出日時 2015-07-12 21:42:50
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 408 ms / 5,000 ms
コード長 582 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 24,964 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 14:30:33
合計ジャッジ時間 1,462 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int dices[12];
long long int sum = 0;

void saiki(long long int mul, int diceNum, int diceMax){
	int i;
	int dice[2][6] = {
		{2,3,5,7,11,13},
		{4,6,8,9,10,12}
	};
	
	if( diceMax == diceNum ){
		sum += mul;
		return;
	}
	
	for(i=0;i<6;i++){
		saiki( mul * dice[dices[diceNum]][i], diceNum+1, diceMax);
	}
	return;
}

int main(void){
	long long int mul = 1;
	double b;
	int i,p,q;
	
	scanf("%d %d", &p, &q);
	for(i=0;i<q;i++){
		dices[i] = 1;
	}
	for(i=0;i<(p+q);i++){
		mul *= 6;
	}
	
	saiki(1, 0, p+q);
	
	b = 1.0*sum/mul;
	
	printf("%.10f\n", b);
	return 0;
}
0