結果

問題 No.162 8020運動
ユーザー 0w10w1
提出日時 2017-04-27 18:47:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 991 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 77,864 KB
最終ジャッジ日時 2023-10-11 16:07:45
合計ジャッジ時間 5,391 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,504 KB
testcase_01 AC 104 ms
76,456 KB
testcase_02 AC 112 ms
77,864 KB
testcase_03 AC 113 ms
77,592 KB
testcase_04 AC 112 ms
77,592 KB
testcase_05 AC 111 ms
77,532 KB
testcase_06 AC 114 ms
77,400 KB
testcase_07 AC 113 ms
77,580 KB
testcase_08 AC 113 ms
77,468 KB
testcase_09 AC 93 ms
71,536 KB
testcase_10 AC 112 ms
77,432 KB
testcase_11 AC 100 ms
76,288 KB
testcase_12 AC 113 ms
76,500 KB
testcase_13 AC 114 ms
77,676 KB
testcase_14 AC 93 ms
71,500 KB
testcase_15 AC 92 ms
71,472 KB
testcase_16 AC 98 ms
76,544 KB
testcase_17 AC 93 ms
71,532 KB
testcase_18 AC 111 ms
77,604 KB
testcase_19 AC 109 ms
77,576 KB
testcase_20 AC 112 ms
77,436 KB
testcase_21 AC 110 ms
77,448 KB
testcase_22 AC 111 ms
77,560 KB
testcase_23 AC 112 ms
77,756 KB
testcase_24 AC 111 ms
77,640 KB
testcase_25 AC 111 ms
77,680 KB
testcase_26 AC 95 ms
71,604 KB
testcase_27 AC 105 ms
76,620 KB
testcase_28 AC 113 ms
77,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy

A = int( input() )
P = list( map( lambda x: int( x ) / 100, input().split() ) )

dp = [ 0.0 for i in range( 2 ) ]
dp = [ deepcopy( dp ) for i in range( 14 + 1 ) ]
dp = [ deepcopy( dp ) for i in range( 80 - A + 1 ) ]
for i in range( 1, 14 + 1 ):
  for j in range( 2 ):
    dp[ 0 ][ i ][ j ] = i

for i in range( 1, 80 - A + 1 ): # 何年たつ
  for j in range( 1, 14 + 1 ): # いくつ歯が残る
    for k in range( 2 ): # 最初の歯の左に歯がある
      if j == 1:
        dp[ i ][ j ][ k ] = ( 1 - P[ k ] ) * dp[ i - 1 ][ j ][ 0 ]
      else:
        all_alive = 1.0
        for x in range( j ): # 最初に壊れる歯
          i_die = P[ 1 ] if ( ( x == 0 and k == 0 ) or x + 1 == j ) else P[ 2 ]
          dp[ i ][ j ][ k ] += all_alive * i_die * ( dp[ i - 1 ][ x ][ 0 ] + dp[ i ][ j - x - 1 ][ 1 ] )
          all_alive *= 1 - i_die
        dp[ i ][ j ][ k ] += all_alive * dp[ i - 1 ][ j ][ 0 ]

print( "%.7f" % ( dp[ 80 - A ][ 14 ][ 0 ] * 2 ) )
0