提出 #36984652
ソースコード 拡げる
MOD = 998244353
n, p = [int(i) for i in input().split()]
dp = [[0] * (n+2) for _ in range(n+1)]
dp[0][n] = 1
p = (p * pow(100, -1, MOD)) % MOD
#p = p/100
if n == 1:
print(1)
exit()
for i in range(1,n+1):
for j in range(n-1, n-2*i-1, -1):
if j == 0:
dp[i][j] = (dp[i-1][j+1] + dp[i-1][j+2] * p) % MOD
break
dp[i][j] = (dp[i-1][j+1] * (1 - p) + dp[i-1][j+2] * p) % MOD
out = 0
for i in range(1, n+1):
out += i * dp[i][0]
print(out%MOD)
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Critical Hit |
| ユーザ | Sozima |
| 言語 | Python (3.8.2) |
| 得点 | 0 |
| コード長 | 518 Byte |
| 結果 | TLE |
| 実行時間 | 2290 ms |
| メモリ | 2635984 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 500 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 26 ms | 9012 KiB |
| example_01.txt | AC | 20 ms | 8964 KiB |
| example_02.txt | AC | 56 ms | 9924 KiB |
| hand_00.txt | AC | 20 ms | 9008 KiB |
| hand_01.txt | AC | 20 ms | 8824 KiB |
| hand_02.txt | AC | 26 ms | 9128 KiB |
| hand_03.txt | AC | 23 ms | 8864 KiB |
| hand_04.txt | AC | 22 ms | 9028 KiB |
| hand_05.txt | AC | 21 ms | 9064 KiB |
| hand_06.txt | TLE | 2288 ms | 2618820 KiB |
| hand_07.txt | TLE | 2289 ms | 2606128 KiB |
| hand_08.txt | TLE | 2289 ms | 2614724 KiB |
| hand_09.txt | TLE | 2288 ms | 2613380 KiB |
| hand_10.txt | TLE | 2271 ms | 1906896 KiB |
| hand_11.txt | TLE | 2286 ms | 2502528 KiB |
| hand_12.txt | TLE | 2271 ms | 1928532 KiB |
| hand_13.txt | TLE | 2270 ms | 1847560 KiB |
| random_00.txt | TLE | 2239 ms | 847260 KiB |
| random_01.txt | TLE | 2274 ms | 1975244 KiB |
| random_02.txt | TLE | 2224 ms | 471076 KiB |
| random_03.txt | TLE | 2272 ms | 1939872 KiB |
| random_04.txt | TLE | 2273 ms | 1955604 KiB |
| random_05.txt | TLE | 2270 ms | 1868644 KiB |
| random_06.txt | TLE | 2269 ms | 1820244 KiB |
| random_07.txt | TLE | 2263 ms | 1600184 KiB |
| random_08.txt | TLE | 2266 ms | 1724028 KiB |
| random_09.txt | TLE | 2267 ms | 1737304 KiB |
| random_10.txt | TLE | 2276 ms | 2126460 KiB |
| random_11.txt | TLE | 2266 ms | 1702892 KiB |
| random_12.txt | TLE | 2284 ms | 2413368 KiB |
| random_13.txt | TLE | 2282 ms | 2365812 KiB |
| random_14.txt | TLE | 2278 ms | 2167448 KiB |
| random_15.txt | TLE | 2289 ms | 2631848 KiB |
| random_16.txt | TLE | 2289 ms | 2624488 KiB |
| random_17.txt | TLE | 2290 ms | 2635984 KiB |
| random_18.txt | TLE | 2288 ms | 2630252 KiB |
| random_19.txt | TLE | 2289 ms | 2627764 KiB |
| random_20.txt | TLE | 2288 ms | 2623924 KiB |
| random_21.txt | TLE | 2289 ms | 2630644 KiB |