結果

問題 No.782 マイナス進数
ユーザー nebukuro09nebukuro09
提出日時 2019-01-12 11:16:33
言語 PyPy2
(7.3.13)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 77,724 KB
実行使用メモリ 80,460 KB
最終ジャッジ日時 2023-08-22 13:41:09
合計ジャッジ時間 8,935 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
76,240 KB
testcase_01 AC 69 ms
76,416 KB
testcase_02 AC 139 ms
80,460 KB
testcase_03 AC 129 ms
80,040 KB
testcase_04 AC 128 ms
80,056 KB
testcase_05 AC 124 ms
80,036 KB
testcase_06 AC 125 ms
80,184 KB
testcase_07 AC 131 ms
80,008 KB
testcase_08 AC 126 ms
80,248 KB
testcase_09 AC 131 ms
80,168 KB
testcase_10 AC 131 ms
80,032 KB
testcase_11 AC 126 ms
80,448 KB
testcase_12 AC 126 ms
80,104 KB
testcase_13 AC 138 ms
79,996 KB
testcase_14 AC 127 ms
79,996 KB
testcase_15 AC 128 ms
80,008 KB
testcase_16 AC 129 ms
79,836 KB
testcase_17 AC 132 ms
79,948 KB
testcase_18 AC 127 ms
80,060 KB
testcase_19 AC 131 ms
80,052 KB
testcase_20 AC 128 ms
79,828 KB
testcase_21 AC 132 ms
79,972 KB
testcase_22 AC 133 ms
80,160 KB
testcase_23 AC 128 ms
80,232 KB
testcase_24 AC 142 ms
80,004 KB
testcase_25 AC 127 ms
80,096 KB
testcase_26 AC 134 ms
80,032 KB
testcase_27 AC 132 ms
80,160 KB
testcase_28 AC 131 ms
80,072 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 #

T, B = map(int, raw_input().split())

def solve():
    N = int(raw_input())
    ans = []
    while N != 0:
        m = N % B
        if m < 0:
            m -= B
        ans.append(m)
        N /= -B
        N *= -1
    print "".join(map(str, reversed(ans)))

for _ in xrange(T):
    solve()
0