結果

問題 No.1047 Zero (Novice)
コンテスト
ユーザー mlihua09
提出日時 2020-08-29 15:11:37
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 266 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 735 ms
コンパイル使用メモリ 81,468 KB
実行使用メモリ 60,072 KB
最終ジャッジ日時 2026-09-22 10:58:04
合計ジャッジ時間 6,883 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code


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