結果

問題 No.782 マイナス進数
ユーザー しらっ亭しらっ亭
提出日時 2017-05-13 00:32:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-10-13 14:03:18
合計ジャッジ時間 4,663 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,788 KB
testcase_01 AC 17 ms
7,912 KB
testcase_02 AC 84 ms
7,908 KB
testcase_03 AC 91 ms
7,820 KB
testcase_04 AC 92 ms
7,912 KB
testcase_05 AC 85 ms
7,872 KB
testcase_06 AC 81 ms
7,816 KB
testcase_07 AC 103 ms
7,812 KB
testcase_08 AC 86 ms
7,916 KB
testcase_09 AC 82 ms
7,908 KB
testcase_10 AC 82 ms
7,788 KB
testcase_11 AC 102 ms
7,816 KB
testcase_12 AC 95 ms
7,972 KB
testcase_13 AC 145 ms
7,812 KB
testcase_14 AC 99 ms
7,872 KB
testcase_15 AC 103 ms
7,848 KB
testcase_16 AC 98 ms
7,908 KB
testcase_17 AC 121 ms
7,956 KB
testcase_18 AC 101 ms
7,820 KB
testcase_19 AC 112 ms
7,848 KB
testcase_20 AC 99 ms
7,816 KB
testcase_21 AC 116 ms
7,912 KB
testcase_22 AC 102 ms
7,908 KB
testcase_23 AC 94 ms
7,912 KB
testcase_24 AC 141 ms
7,916 KB
testcase_25 AC 98 ms
7,944 KB
testcase_26 AC 107 ms
7,912 KB
testcase_27 AC 102 ms
7,860 KB
testcase_28 AC 97 ms
7,808 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

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