結果

問題 No.782 マイナス進数
ユーザー stngstng
提出日時 2022-06-12 18:47:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 81,692 KB
実行使用メモリ 76,384 KB
最終ジャッジ日時 2023-10-24 12:50:57
合計ジャッジ時間 5,372 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,444 KB
testcase_01 AC 37 ms
53,444 KB
testcase_02 AC 85 ms
76,340 KB
testcase_03 AC 93 ms
76,156 KB
testcase_04 AC 90 ms
76,224 KB
testcase_05 AC 87 ms
76,340 KB
testcase_06 AC 85 ms
76,384 KB
testcase_07 AC 89 ms
76,148 KB
testcase_08 AC 86 ms
76,252 KB
testcase_09 AC 88 ms
76,160 KB
testcase_10 AC 86 ms
76,340 KB
testcase_11 AC 91 ms
76,144 KB
testcase_12 AC 89 ms
76,148 KB
testcase_13 AC 103 ms
76,164 KB
testcase_14 AC 90 ms
76,236 KB
testcase_15 AC 92 ms
76,128 KB
testcase_16 AC 88 ms
76,124 KB
testcase_17 AC 95 ms
76,164 KB
testcase_18 AC 90 ms
76,144 KB
testcase_19 AC 93 ms
76,180 KB
testcase_20 AC 89 ms
76,140 KB
testcase_21 AC 94 ms
76,164 KB
testcase_22 AC 92 ms
76,140 KB
testcase_23 AC 90 ms
76,116 KB
testcase_24 AC 100 ms
76,156 KB
testcase_25 AC 90 ms
76,152 KB
testcase_26 AC 91 ms
76,120 KB
testcase_27 AC 90 ms
76,148 KB
testcase_28 AC 89 ms
76,144 KB
testcase_29 AC 38 ms
53,468 KB
testcase_30 AC 37 ms
53,468 KB
testcase_31 AC 37 ms
53,468 KB
testcase_32 AC 41 ms
59,660 KB
testcase_33 AC 37 ms
53,468 KB
testcase_34 AC 38 ms
53,468 KB
testcase_35 AC 37 ms
53,468 KB
testcase_36 AC 38 ms
53,468 KB
testcase_37 AC 38 ms
53,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Base_10_to_n(X, n):
    if X == 0:
        return "0"
    ans = ""
    cnt = 0
    while X > 0:
        tmp = X % n
        if cnt % 2 == 1 and tmp != 0:
            tmp = n-tmp
            X += tmp
        X //= n
        cnt += 1
        ans = str(tmp) + ans
    return ans

t,b = map(int,input().split())
n = [int(input()) for i in range(t)]
for i in range(t):
    print(Base_10_to_n(n[i],abs(b)))
0