結果
| 問題 | No.23 技の選択 | 
| コンテスト | |
| ユーザー |  yuma25689 | 
| 提出日時 | 2015-11-07 14:33:55 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 44 ms / 5,000 ms | 
| コード長 | 1,213 bytes | 
| コンパイル時間 | 82 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-06-28 16:49:16 | 
| 合計ジャッジ時間 | 2,174 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
# H A D # 一行に、敵の体力Hと通常攻撃のダメージ量A、必殺技のダメージ量Dが半角スペース区切りで与えられる。 # 1≤H,A,D≤10000 import sys line=sys.stdin.readline() line1=line.split() enemyHP = int(line1[0]) normalDamage=int(line1[1]) criticalDamage=int(line1[2]) INF=10e9 # HPに対する最小期待回数の配列 HPandAttackCount=[INF for i in range(enemyHP+1)] HPandAttackCount[0]=0; for hp in range(1,enemyHP+1): # 計算済みでない場合のみ計算 if HPandAttackCount[hp] != INF: continue # 現在ループ中のhpに対する対象の回数期待値を求める # 必殺技は、2/3回しか当たらないので、1.5回とみなせば良いらしい # 通常! if 0<=hp-normalDamage: HPandAttackCount[hp] = min(HPandAttackCount[hp], \ HPandAttackCount[hp-normalDamage]+1.0 ) else: HPandAttackCount[hp] = min(HPandAttackCount[hp], 1.0 ) # 必殺! if 0<=hp-criticalDamage: HPandAttackCount[hp] = min(HPandAttackCount[hp], \ HPandAttackCount[hp-criticalDamage]+1.5 ) else: HPandAttackCount[hp] = min(HPandAttackCount[hp], 1.5 ) # for dp in HPandAttackCount: # print(dp) print( HPandAttackCount[enemyHP] )
