結果

問題 No.1047 Zero (Novice)
ユーザー neterukunneterukun
提出日時 2020-05-08 21:27:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 178 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 57,444 KB
最終ジャッジ日時 2024-07-03 23:46:39
合計ジャッジ時間 1,568 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split())

n = 0
cnt = 0
while cnt <= 1000:
    cnt += 1
    new_n = a * n + b
    if new_n == 0:
        print(cnt)
        exit()
    n = new_n
print(-1)
0