結果

問題 No.2685 Cell Proliferation (Easy)
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-03-01 15:31:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 910 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 93,640 KB
最終ジャッジ日時 2024-03-20 20:17:01
合計ジャッジ時間 6,466 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 373 ms
93,264 KB
testcase_02 AC 68 ms
75,632 KB
testcase_03 AC 200 ms
83,680 KB
testcase_04 AC 229 ms
85,512 KB
testcase_05 AC 96 ms
77,444 KB
testcase_06 AC 149 ms
80,908 KB
testcase_07 AC 174 ms
82,360 KB
testcase_08 AC 206 ms
84,172 KB
testcase_09 AC 272 ms
87,100 KB
testcase_10 AC 150 ms
80,904 KB
testcase_11 AC 117 ms
78,916 KB
testcase_12 AC 126 ms
79,568 KB
testcase_13 AC 181 ms
82,492 KB
testcase_14 AC 225 ms
84,968 KB
testcase_15 AC 339 ms
91,316 KB
testcase_16 AC 205 ms
84,132 KB
testcase_17 AC 57 ms
72,276 KB
testcase_18 AC 143 ms
80,376 KB
testcase_19 AC 159 ms
81,308 KB
testcase_20 AC 88 ms
77,152 KB
testcase_21 AC 73 ms
75,936 KB
testcase_22 AC 308 ms
89,412 KB
testcase_23 AC 108 ms
78,380 KB
testcase_24 AC 376 ms
93,640 KB
testcase_25 AC 249 ms
86,044 KB
testcase_26 AC 197 ms
84,932 KB
testcase_27 AC 85 ms
76,764 KB
testcase_28 AC 203 ms
84,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

想定解?

solve(L,R) = 
L-0.000001 秒を迎えた細胞ひとつが、R+0.9秒でいくつになっているか?

"""

import sys
sys.setrecursionlimit(10**6+10)

mod = 998244353

P1,P2,Q1,Q2,T = map(int,input().split())

P12 = P1 * pow(P2,mod-2,mod) % mod
Q12 = Q1 * pow(Q2,mod-2,mod) % mod

lis = [[None] * (T+1) for i in range(T+1)]

def solve(L,R):

    #print (L,R)
    if lis[L][R] != None:
        return lis[L][R]

    assert L <= R

    live = pow(Q12,L,mod)

    # 自分
    if L == R:
        if L == 0:
            now_me = 1
        else:
            now_me = live
    else:
        if L == 0:
            now_me = solve(L+1,R)
        else:
            now_me = solve(L+1,R) * live

    # 分岐
    if L == 0:
        now_make = 0
    else:
        now_make = solve(0,R-L) * P12

    now = now_me + now_make

    lis[L][R] = now % mod
    return lis[L][R]

print (solve(0,T) % mod)
0