結果

問題 No.782 マイナス進数
ユーザー maspymaspy
提出日時 2020-02-03 21:50:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-09-19 06:57:24
合計ジャッジ時間 4,674 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

T,B,*nums = map(int,read().split())

for n in nums:
    rep = []
    if not n:
        print(0)
        continue
    while n:
        r = n % (-B)
        n = (n - r) // B
        rep.append(r)
    print(''.join(map(str,reversed(rep))))

0