結果

問題 No.782 マイナス進数
ユーザー 👑 rin204rin204
提出日時 2022-09-30 23:10:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 78,188 KB
最終ジャッジ日時 2023-08-24 16:44:45
合計ジャッジ時間 8,461 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,012 KB
testcase_01 AC 71 ms
71,276 KB
testcase_02 AC 194 ms
77,580 KB
testcase_03 AC 155 ms
77,760 KB
testcase_04 AC 154 ms
77,736 KB
testcase_05 AC 158 ms
77,424 KB
testcase_06 AC 150 ms
78,188 KB
testcase_07 AC 160 ms
77,600 KB
testcase_08 AC 151 ms
77,732 KB
testcase_09 AC 149 ms
78,048 KB
testcase_10 AC 150 ms
77,648 KB
testcase_11 AC 157 ms
77,436 KB
testcase_12 AC 159 ms
77,504 KB
testcase_13 AC 172 ms
77,800 KB
testcase_14 AC 159 ms
77,672 KB
testcase_15 AC 159 ms
77,696 KB
testcase_16 AC 159 ms
77,360 KB
testcase_17 AC 182 ms
78,112 KB
testcase_18 AC 163 ms
77,536 KB
testcase_19 AC 163 ms
77,696 KB
testcase_20 AC 163 ms
77,512 KB
testcase_21 AC 174 ms
77,752 KB
testcase_22 AC 163 ms
77,616 KB
testcase_23 AC 165 ms
77,804 KB
testcase_24 AC 173 ms
77,572 KB
testcase_25 AC 164 ms
77,584 KB
testcase_26 AC 173 ms
77,572 KB
testcase_27 AC 158 ms
77,608 KB
testcase_28 AC 157 ms
77,632 KB
testcase_29 AC 73 ms
71,244 KB
testcase_30 AC 74 ms
71,192 KB
testcase_31 AC 74 ms
71,264 KB
testcase_32 AC 84 ms
76,460 KB
testcase_33 AC 73 ms
71,188 KB
testcase_34 AC 72 ms
71,292 KB
testcase_35 AC 72 ms
71,044 KB
testcase_36 AC 74 ms
71,240 KB
testcase_37 AC 74 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t, b = map(int, input().split())

def solve(n):
    if n == 0:
        print(0)
        return

    A = []
    x = 1
    y = abs(b)
    while n != 0:
        c = 0
        while n % y != 0:
            c += 1
            n -= x
        A.append(c)
        x *= b
        y *= abs(b)
    print(*A[::-1], sep="")

for _ in range(t):
    n = int(input())
    solve(n)
0