結果

問題 No.1047 Zero (Novice)
ユーザー 蕎麦屋蕎麦屋
提出日時 2020-05-08 21:45:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 75,800 KB
最終ジャッジ日時 2023-09-17 02:28:05
合計ジャッジ時間 2,814 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,540 KB
testcase_01 AC 73 ms
71,448 KB
testcase_02 AC 72 ms
71,192 KB
testcase_03 AC 71 ms
71,296 KB
testcase_04 AC 72 ms
71,140 KB
testcase_05 AC 71 ms
71,240 KB
testcase_06 AC 72 ms
71,440 KB
testcase_07 AC 69 ms
71,304 KB
testcase_08 AC 72 ms
71,072 KB
testcase_09 AC 72 ms
71,332 KB
testcase_10 AC 76 ms
75,676 KB
testcase_11 AC 76 ms
75,748 KB
testcase_12 AC 77 ms
75,800 KB
testcase_13 AC 72 ms
71,348 KB
testcase_14 AC 72 ms
71,200 KB
testcase_15 AC 71 ms
71,200 KB
testcase_16 AC 73 ms
71,192 KB
testcase_17 AC 73 ms
71,196 KB
testcase_18 AC 73 ms
71,372 KB
testcase_19 AC 72 ms
71,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


a,b = list(map(int, input().split()))
n = 0
ans = -1
for i in range(10**6):
    n = a*n+b
    if(n==0):
        ans = i+1
        break
    if(abs(n)>10**10):
        ans = -1
        break

print(ans)
0