結果
| 問題 |
No.1648 Sum of Powers
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-08-13 22:33:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 421 bytes |
| コンパイル時間 | 201 ms |
| コンパイル使用メモリ | 82,216 KB |
| 実行使用メモリ | 101,360 KB |
| 最終ジャッジ日時 | 2024-10-03 20:17:44 |
| 合計ジャッジ時間 | 7,830 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 53 WA * 3 |
ソースコード
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()
convexineq