結果

問題 No.782 マイナス進数
ユーザー maspymaspy
提出日時 2020-02-03 21:50:06
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 11,764 KB
実行使用メモリ 10,900 KB
最終ジャッジ日時 2023-10-19 10:46:54
合計ジャッジ時間 4,640 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,980 KB
testcase_01 AC 29 ms
9,980 KB
testcase_02 AC 69 ms
10,860 KB
testcase_03 AC 79 ms
10,860 KB
testcase_04 AC 87 ms
10,860 KB
testcase_05 AC 74 ms
10,860 KB
testcase_06 AC 71 ms
10,860 KB
testcase_07 AC 113 ms
10,860 KB
testcase_08 AC 76 ms
10,860 KB
testcase_09 AC 68 ms
10,860 KB
testcase_10 AC 69 ms
10,860 KB
testcase_11 AC 109 ms
10,900 KB
testcase_12 AC 100 ms
10,900 KB
testcase_13 AC 197 ms
10,900 KB
testcase_14 AC 99 ms
10,900 KB
testcase_15 AC 110 ms
10,900 KB
testcase_16 AC 100 ms
10,900 KB
testcase_17 AC 147 ms
10,900 KB
testcase_18 AC 100 ms
10,900 KB
testcase_19 AC 128 ms
10,900 KB
testcase_20 AC 99 ms
10,900 KB
testcase_21 AC 141 ms
10,900 KB
testcase_22 AC 105 ms
10,900 KB
testcase_23 AC 90 ms
10,900 KB
testcase_24 AC 190 ms
10,900 KB
testcase_25 AC 98 ms
10,900 KB
testcase_26 AC 119 ms
10,900 KB
testcase_27 AC 107 ms
10,900 KB
testcase_28 AC 96 ms
10,900 KB
testcase_29 AC 29 ms
9,980 KB
testcase_30 AC 29 ms
9,980 KB
testcase_31 AC 30 ms
9,980 KB
testcase_32 AC 30 ms
9,984 KB
testcase_33 AC 30 ms
9,980 KB
testcase_34 AC 30 ms
9,980 KB
testcase_35 AC 29 ms
9,980 KB
testcase_36 AC 29 ms
9,980 KB
testcase_37 AC 29 ms
9,980 KB
権限があれば一括ダウンロードができます

ソースコード

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