結果

問題 No.782 マイナス進数
ユーザー chun1182chun1182
提出日時 2019-01-12 13:08:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,568 KB
実行使用メモリ 8,728 KB
最終ジャッジ日時 2023-08-22 18:01:00
合計ジャッジ時間 5,113 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,772 KB
testcase_01 AC 14 ms
7,760 KB
testcase_02 AC 66 ms
8,724 KB
testcase_03 AC 76 ms
8,644 KB
testcase_04 AC 83 ms
8,676 KB
testcase_05 AC 71 ms
8,588 KB
testcase_06 AC 65 ms
8,560 KB
testcase_07 AC 108 ms
8,696 KB
testcase_08 AC 74 ms
8,632 KB
testcase_09 AC 66 ms
8,584 KB
testcase_10 AC 70 ms
8,728 KB
testcase_11 AC 106 ms
8,584 KB
testcase_12 AC 92 ms
8,700 KB
testcase_13 AC 197 ms
8,656 KB
testcase_14 AC 100 ms
8,680 KB
testcase_15 AC 112 ms
8,640 KB
testcase_16 AC 102 ms
8,640 KB
testcase_17 AC 147 ms
8,476 KB
testcase_18 AC 105 ms
8,544 KB
testcase_19 AC 131 ms
8,652 KB
testcase_20 AC 102 ms
8,524 KB
testcase_21 AC 139 ms
8,468 KB
testcase_22 AC 111 ms
8,580 KB
testcase_23 AC 90 ms
8,520 KB
testcase_24 AC 184 ms
8,560 KB
testcase_25 AC 100 ms
8,692 KB
testcase_26 AC 122 ms
8,620 KB
testcase_27 AC 111 ms
8,516 KB
testcase_28 AC 97 ms
8,636 KB
testcase_29 AC 15 ms
7,908 KB
testcase_30 AC 15 ms
7,760 KB
testcase_31 AC 15 ms
7,824 KB
testcase_32 AC 15 ms
7,832 KB
testcase_33 AC 15 ms
7,856 KB
testcase_34 AC 14 ms
7,780 KB
testcase_35 AC 15 ms
7,764 KB
testcase_36 AC 14 ms
7,764 KB
testcase_37 AC 14 ms
7,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t,k=map(int, input().split())
a=[int(input()) for i in range(t)]
for n in a:
    ans=''
    if n==0:ans='0'
    while n!=0:
        if n%-k==0:ans+='0'
        else:ans+=str(n%-k)
        n=-(n//-k)
    print(ans[::-1])
0