結果

問題 No.782 マイナス進数
ユーザー silversmithsilversmith
提出日時 2019-05-01 21:02:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 370 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 8,788 KB
最終ジャッジ日時 2023-08-30 04:28:02
合計ジャッジ時間 6,284 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,872 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 81 ms
8,656 KB
testcase_03 AC 94 ms
8,652 KB
testcase_04 AC 108 ms
8,788 KB
testcase_05 AC 88 ms
8,704 KB
testcase_06 AC 81 ms
8,672 KB
testcase_07 AC 142 ms
8,704 KB
testcase_08 AC 93 ms
8,624 KB
testcase_09 AC 82 ms
8,632 KB
testcase_10 AC 81 ms
8,764 KB
testcase_11 AC 136 ms
8,772 KB
testcase_12 AC 125 ms
8,716 KB
testcase_13 AC 260 ms
8,656 KB
testcase_14 AC 124 ms
8,764 KB
testcase_15 AC 137 ms
8,704 KB
testcase_16 AC 124 ms
8,724 KB
testcase_17 AC 191 ms
8,644 KB
testcase_18 AC 123 ms
8,632 KB
testcase_19 AC 166 ms
8,660 KB
testcase_20 AC 129 ms
8,604 KB
testcase_21 AC 188 ms
8,712 KB
testcase_22 AC 139 ms
8,640 KB
testcase_23 AC 116 ms
8,648 KB
testcase_24 AC 256 ms
8,648 KB
testcase_25 AC 124 ms
8,764 KB
testcase_26 AC 156 ms
8,636 KB
testcase_27 AC 142 ms
8,672 KB
testcase_28 AC 123 ms
8,628 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,input().split())
N = [int(input()) for l in range(T)]

plusB = -B
for t in N:
    a = []
    sign = 1
    while t != 0:
        if sign > 0:
            a.append(t % plusB)
            t = (t - a[-1]) / plusB
        else:
            a.append(-t % plusB)
            t = (t +a[-1]) / plusB
        sign *=-1
    print(''.join(map(str,map(int,a[::-1]))))
0