結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー ktrk15ktrk15
提出日時 2015-05-22 23:54:51
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 716 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 814,912 KB
最終ジャッジ日時 2023-09-20 10:09:46
合計ジャッジ時間 5,519 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

input = raw_input().split(' ')
P = int(input[0])
C = int(input[1])
sosu = [[2.0,1.0/6],[3.0,1.0/6],[5.0,1.0/6],[7.0,1.0/6],[11.0,1.0/6],[13.0,1.0/6]]
gouseisu = [[4.0,1.0/6],[6.0,1.0/6],[8.0,1.0/6],[9.0,1.0/6],[10.0,1.0/6],[12.0,1.0/6]]

def cal(list,saikoro,n):
	if n == 0:
		return list
	else:
		if len(list) == 0:
			list = saikoro
		copy = saikoro	

	if n == 1:
		return saikoro
	else:
		for vp in list:
			for cp in copy:
			    list.append([cp[0]*vp[0],cp[1]*vp[1]])
    	return cal(list,saikoro,int(n)-1)

s_list = []
g_list = []
s_out = cal(s_list,sosu,P)
g_out = cal(g_list,gouseisu,C)
sss = 0.0
ggg = 0.0
for tmp in s_out:
    sss += tmp[0]*tmp[1]
for tmp in g_out:
    ggg += tmp[0]*tmp[1]

print sss+ggg
0