結果
| 問題 | No.1047 Zero (Novice) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-08 22:41:53 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 456 bytes |
| 記録 | |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 30,752 KB |
| 最終ジャッジ日時 | 2026-03-25 09:01:44 |
| 合計ジャッジ時間 | 9,343 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 2 |
ソースコード
from sys import stdin
def main():
input = lambda: stdin.readline()[:-1]
A, B = map(int, input().split())
if (A > 0 and B > 0) or (not A and B != 0):
print(-1)
return
elif not A and not B:
print(1)
return
if B % A:
print(-1)
else:
ans, n = 0, 0
while 1:
n = A * n + B
ans += 1
if not n:
break
print(ans)
main()