結果

問題 No.782 マイナス進数
ユーザー hedwig100hedwig100
提出日時 2020-04-26 10:38:07
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 8,792 KB
最終ジャッジ日時 2023-08-10 02:30:04
合計ジャッジ時間 4,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 50 ms
8,728 KB
testcase_03 AC 57 ms
8,628 KB
testcase_04 AC 60 ms
8,596 KB
testcase_05 AC 52 ms
8,640 KB
testcase_06 AC 51 ms
8,736 KB
testcase_07 AC 75 ms
8,548 KB
testcase_08 AC 55 ms
8,624 KB
testcase_09 AC 51 ms
8,792 KB
testcase_10 AC 51 ms
8,612 KB
testcase_11 AC 72 ms
8,664 KB
testcase_12 AC 68 ms
8,580 KB
testcase_13 AC 119 ms
8,692 KB
testcase_14 AC 67 ms
8,572 KB
testcase_15 AC 73 ms
8,604 KB
testcase_16 AC 67 ms
8,592 KB
testcase_17 AC 93 ms
8,552 KB
testcase_18 AC 68 ms
8,560 KB
testcase_19 AC 82 ms
8,672 KB
testcase_20 AC 67 ms
8,528 KB
testcase_21 AC 88 ms
8,716 KB
testcase_22 AC 71 ms
8,572 KB
testcase_23 AC 62 ms
8,576 KB
testcase_24 AC 117 ms
8,536 KB
testcase_25 AC 67 ms
8,696 KB
testcase_26 AC 78 ms
8,620 KB
testcase_27 AC 71 ms
8,576 KB
testcase_28 AC 66 ms
8,580 KB
testcase_29 AC 15 ms
7,840 KB
testcase_30 AC 16 ms
7,808 KB
testcase_31 AC 16 ms
7,908 KB
testcase_32 AC 16 ms
7,848 KB
testcase_33 AC 15 ms
7,860 KB
testcase_34 AC 15 ms
7,792 KB
testcase_35 AC 15 ms
7,848 KB
testcase_36 AC 16 ms
7,740 KB
testcase_37 AC 16 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10 ** 9
MOD = 10 **9 + 7
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    t,b = map(int,input().split())
    b *= -1
    N = [int(input()) for _ in range(t)]

    for n in N:
        if n == 0:
            print(0)
            continue
        ans = ''
        while n:
            ans += str(n%b)
            n //= b
            n *= -1
        print(ans[::-1])
if __name__=='__main__':
    main()
0