結果
| 問題 | No.1047 Zero (Novice) | 
| コンテスト | |
| ユーザー |  Fuyuru | 
| 提出日時 | 2020-06-15 16:53:56 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 547 bytes | 
| コンパイル時間 | 169 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,648 KB | 
| 最終ジャッジ日時 | 2024-07-03 11:29:20 | 
| 合計ジャッジ時間 | 1,655 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
A,B = l()
N = 0
for i in range(50):
    N = A*N+B
    if N == 0:
        print(i+1)
        exit()
print(-1)
            
            
            
        