結果

問題 No.1047 Zero (Novice)
ユーザー mlihua09
提出日時 2020-08-29 15:11:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 266 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 111,840 KB
最終ジャッジ日時 2024-11-14 13:14:12
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #


A, B = map(int, input().split())

x = B

i = 1

if A == 0 and B != 0:
    
    print(-1)
    exit()

while x != 0:
    
    if x % A == 0:
        
        x //= A
        x += B
        
    else:
        
        print(-1)
        exit()
    i += 1
    
print(i)
0