結果

問題 No.1648 Sum of Powers
ユーザー convexineqconvexineq
提出日時 2021-08-13 22:33:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 101,432 KB
最終ジャッジ日時 2024-04-14 18:52:25
合計ジャッジ時間 7,473 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
93,516 KB
testcase_01 AC 54 ms
70,592 KB
testcase_02 AC 79 ms
93,868 KB
testcase_03 AC 77 ms
94,272 KB
testcase_04 AC 79 ms
94,188 KB
testcase_05 AC 75 ms
94,144 KB
testcase_06 AC 77 ms
95,136 KB
testcase_07 AC 75 ms
93,580 KB
testcase_08 AC 80 ms
95,556 KB
testcase_09 AC 79 ms
94,672 KB
testcase_10 AC 78 ms
94,480 KB
testcase_11 AC 74 ms
92,896 KB
testcase_12 AC 79 ms
94,440 KB
testcase_13 AC 76 ms
94,460 KB
testcase_14 AC 74 ms
93,880 KB
testcase_15 AC 78 ms
94,380 KB
testcase_16 AC 79 ms
94,816 KB
testcase_17 AC 79 ms
94,356 KB
testcase_18 AC 75 ms
93,420 KB
testcase_19 AC 75 ms
94,108 KB
testcase_20 AC 73 ms
93,164 KB
testcase_21 AC 77 ms
95,484 KB
testcase_22 AC 80 ms
94,804 KB
testcase_23 AC 78 ms
95,548 KB
testcase_24 AC 78 ms
95,092 KB
testcase_25 AC 79 ms
94,460 KB
testcase_26 AC 79 ms
95,164 KB
testcase_27 AC 79 ms
94,576 KB
testcase_28 AC 80 ms
95,868 KB
testcase_29 AC 80 ms
94,392 KB
testcase_30 AC 79 ms
94,620 KB
testcase_31 AC 80 ms
95,252 KB
testcase_32 AC 79 ms
94,320 KB
testcase_33 AC 78 ms
94,000 KB
testcase_34 AC 77 ms
94,432 KB
testcase_35 AC 78 ms
94,844 KB
testcase_36 AC 77 ms
94,868 KB
testcase_37 AC 82 ms
95,068 KB
testcase_38 AC 80 ms
95,620 KB
testcase_39 AC 82 ms
94,704 KB
testcase_40 AC 78 ms
94,188 KB
testcase_41 AC 86 ms
95,436 KB
testcase_42 AC 79 ms
94,528 KB
testcase_43 AC 80 ms
95,720 KB
testcase_44 AC 79 ms
94,568 KB
testcase_45 AC 80 ms
94,256 KB
testcase_46 AC 80 ms
94,880 KB
testcase_47 AC 79 ms
94,548 KB
testcase_48 AC 54 ms
70,852 KB
testcase_49 AC 79 ms
95,472 KB
testcase_50 AC 78 ms
94,724 KB
testcase_51 AC 55 ms
71,440 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 80 ms
94,472 KB
testcase_56 AC 82 ms
95,220 KB
testcase_57 AC 55 ms
70,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

T = 10**5+1
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