結果

問題 No.782 マイナス進数
ユーザー titiatitia
提出日時 2019-01-11 23:19:59
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 235 ms
使用メモリ 7,724 KB
最終ジャッジ日時 2023-01-06 18:14:38
合計ジャッジ時間 8,843 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 15 ms
7,640 KB
testcase_01 AC 15 ms
7,496 KB
testcase_02 AC 137 ms
7,576 KB
testcase_03 AC 162 ms
7,656 KB
testcase_04 AC 191 ms
7,524 KB
testcase_05 AC 146 ms
7,708 KB
testcase_06 AC 138 ms
7,512 KB
testcase_07 AC 258 ms
7,700 KB
testcase_08 AC 158 ms
7,712 KB
testcase_09 AC 134 ms
7,584 KB
testcase_10 AC 138 ms
7,508 KB
testcase_11 AC 254 ms
7,568 KB
testcase_12 AC 230 ms
7,724 KB
testcase_13 AC 537 ms
7,520 KB
testcase_14 AC 233 ms
7,524 KB
testcase_15 AC 265 ms
7,528 KB
testcase_16 AC 231 ms
7,632 KB
testcase_17 AC 382 ms
7,712 KB
testcase_18 AC 232 ms
7,632 KB
testcase_19 AC 320 ms
7,556 KB
testcase_20 AC 228 ms
7,716 KB
testcase_21 AC 349 ms
7,700 KB
testcase_22 AC 252 ms
7,696 KB
testcase_23 AC 202 ms
7,544 KB
testcase_24 AC 523 ms
7,520 KB
testcase_25 AC 230 ms
7,564 KB
testcase_26 AC 288 ms
7,588 KB
testcase_27 AC 254 ms
7,572 KB
testcase_28 AC 225 ms
7,676 KB
testcase_29 AC 15 ms
7,656 KB
testcase_30 AC 14 ms
7,636 KB
testcase_31 AC 15 ms
7,488 KB
testcase_32 AC 17 ms
7,568 KB
testcase_33 AC 15 ms
7,520 KB
testcase_34 AC 14 ms
7,488 KB
testcase_35 AC 15 ms
7,504 KB
testcase_36 AC 15 ms
7,548 KB
testcase_37 AC 15 ms
7,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for i in range(T):
    ANS=""
    N=int(input())
    if N==0:
        print(0)
        continue
    for i in range(1,100):
        if N==0:
            break
        x=N%(-B**i)
        ANS+=str(x//(B**(i-1)))
        N-=x

        #print(N,ANS)

    print(ANS[::-1])
        
        
0