結果

問題 No.1648 Sum of Powers
ユーザー convexineqconvexineq
提出日時 2021-08-13 22:35:26
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 130,592 KB
最終ジャッジ日時 2023-07-27 05:39:50
合計ジャッジ時間 14,078 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
130,284 KB
testcase_01 AC 98 ms
76,508 KB
testcase_02 AC 152 ms
130,288 KB
testcase_03 AC 147 ms
130,304 KB
testcase_04 AC 148 ms
130,296 KB
testcase_05 AC 149 ms
130,160 KB
testcase_06 AC 151 ms
130,272 KB
testcase_07 AC 156 ms
130,312 KB
testcase_08 AC 158 ms
130,284 KB
testcase_09 AC 152 ms
130,340 KB
testcase_10 AC 151 ms
130,320 KB
testcase_11 AC 146 ms
130,164 KB
testcase_12 AC 147 ms
130,216 KB
testcase_13 AC 156 ms
130,296 KB
testcase_14 AC 147 ms
130,088 KB
testcase_15 AC 148 ms
130,220 KB
testcase_16 AC 150 ms
130,316 KB
testcase_17 AC 158 ms
130,504 KB
testcase_18 AC 152 ms
130,312 KB
testcase_19 AC 145 ms
130,092 KB
testcase_20 AC 143 ms
130,552 KB
testcase_21 AC 143 ms
130,124 KB
testcase_22 AC 147 ms
130,420 KB
testcase_23 AC 145 ms
130,308 KB
testcase_24 AC 154 ms
130,248 KB
testcase_25 AC 157 ms
130,304 KB
testcase_26 AC 152 ms
130,252 KB
testcase_27 AC 154 ms
130,344 KB
testcase_28 AC 156 ms
130,484 KB
testcase_29 AC 152 ms
130,160 KB
testcase_30 AC 153 ms
130,156 KB
testcase_31 AC 159 ms
130,340 KB
testcase_32 AC 150 ms
130,388 KB
testcase_33 AC 182 ms
130,304 KB
testcase_34 AC 146 ms
130,220 KB
testcase_35 AC 149 ms
130,132 KB
testcase_36 AC 147 ms
130,212 KB
testcase_37 AC 150 ms
130,236 KB
testcase_38 AC 152 ms
130,260 KB
testcase_39 AC 154 ms
130,368 KB
testcase_40 AC 152 ms
130,316 KB
testcase_41 AC 149 ms
130,332 KB
testcase_42 AC 150 ms
130,320 KB
testcase_43 AC 153 ms
130,248 KB
testcase_44 AC 150 ms
130,308 KB
testcase_45 AC 154 ms
130,148 KB
testcase_46 AC 157 ms
130,268 KB
testcase_47 AC 156 ms
130,256 KB
testcase_48 AC 104 ms
76,648 KB
testcase_49 AC 163 ms
130,332 KB
testcase_50 AC 157 ms
130,160 KB
testcase_51 AC 96 ms
76,520 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 157 ms
130,208 KB
testcase_56 AC 159 ms
130,148 KB
testcase_57 AC 95 ms
76,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
a,b,p,q = map(int,input().split())

T = 2*10**5
memo = {}
f = lambda x,y: (y,(a*y-b*x)%MOD)
B = (q,p)
for i in range(T):
    memo[B] = i
    B = f(*B)

v,w = (1,0),(0,1)
for _ in range(T):
    v,w = f(*v),f(*w)
c1,c2 = v
c3,c4 = w
g = lambda x,y: ((c1*x+c3*y)%MOD,(c2*x+c4*y)%MOD)

s = f(2,a)
for j in range(1,T+1):
    s = g(*s)
    if s in memo:
        i = memo[s]
        print(j*T-i+2)
        exit()
0