結果
| 問題 |
No.1047 Zero (Novice)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-13 22:18:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 387 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 333,440 KB |
| 最終ジャッジ日時 | 2024-09-14 15:42:34 |
| 合計ジャッジ時間 | 3,841 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 TLE * 1 -- * 14 |
ソースコード
A, B = map(int, input().split())
N = B
L = [B]
K = 0
if A >= 0 and B > 0 or A < 0 and B < 0:
K = -1
elif B == 0:
K = 1
else:
while N != 0:
N = A * N + B
if N == 0:
K = len(L) + 1
break
else:
if N in L:
K = -1
break
else:
L.append(N)
print(K)