結果
問題 |
No.2193 メガの下1桁
|
ユーザー |
![]() |
提出日時 | 2025-06-12 19:19:14 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 295 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 66,852 KB |
最終ジャッジ日時 | 2025-06-12 19:19:20 |
合計ジャッジ時間 | 5,480 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 WA * 6 TLE * 1 -- * 4 |
ソースコード
M = int(input()) D = int(input()) N = int(input()) B = int(input()) current = M % B steps = 0 prev = None while steps < N: if current == prev: # Convergence detected, break the loop break prev = current a = (current + D) % B e = current if a == 0: if e == 0: current = 1 % B else: current = 0 else: if e == 0: current = 1 % B else: current = pow(a, e, B) steps += 1 # Determine the last digit in base B digit = current % B print(digit if digit < 10 else 'A')