結果
| 問題 | No.1047 Zero (Novice) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-05-08 21:52:31 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 304 bytes | 
| コンパイル時間 | 87 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 17,060 KB | 
| 最終ジャッジ日時 | 2024-07-04 00:31:44 | 
| 合計ジャッジ時間 | 3,715 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 1 TLE * 1 -- * 15 | 
ソースコード
from sys import stdin
def main():
    input = lambda: stdin.readline()[:-1]
    A, B = map(int, input().split())
    if A > 0 and B > 0:
        print(-1)
        return
    ans, n = 0, 0
    while 1:
        n = A * n + B
        if not n:
            break
        ans += 1
    print(ans)
main()
            
            
            
        