結果

問題 No.782 マイナス進数
ユーザー しらっ亭
提出日時 2017-05-13 00:32:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-15 10:50:30
合計ジャッジ時間 5,583 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    t, b = map(int, input().split())

    o0 = ord('0')

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

        ans = []

        while n:
            n, m = divmod(n, b)
            if m < 0:
                m -= b
                n += 1
            ans.append(m)

        ans = ans[::-1]
        print(''.join(chr(o0 + a) for a in ans))


if __name__ == '__main__':
    solve()
0