結果

問題 No.782 マイナス進数
ユーザー titiatitia
提出日時 2019-01-11 23:19:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 364 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-08-20 11:42:27
合計ジャッジ時間 7,817 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,856 KB
testcase_01 AC 17 ms
7,960 KB
testcase_02 AC 116 ms
7,796 KB
testcase_03 AC 129 ms
7,856 KB
testcase_04 AC 145 ms
7,932 KB
testcase_05 AC 120 ms
7,988 KB
testcase_06 AC 114 ms
7,816 KB
testcase_07 AC 189 ms
7,856 KB
testcase_08 AC 128 ms
7,812 KB
testcase_09 AC 114 ms
7,796 KB
testcase_10 AC 116 ms
7,808 KB
testcase_11 AC 190 ms
7,784 KB
testcase_12 AC 175 ms
7,784 KB
testcase_13 AC 364 ms
7,928 KB
testcase_14 AC 176 ms
7,880 KB
testcase_15 AC 193 ms
7,812 KB
testcase_16 AC 174 ms
7,936 KB
testcase_17 AC 272 ms
7,804 KB
testcase_18 AC 174 ms
7,988 KB
testcase_19 AC 233 ms
7,804 KB
testcase_20 AC 170 ms
7,868 KB
testcase_21 AC 245 ms
7,804 KB
testcase_22 AC 208 ms
7,868 KB
testcase_23 AC 155 ms
7,864 KB
testcase_24 AC 357 ms
7,812 KB
testcase_25 AC 173 ms
7,920 KB
testcase_26 AC 216 ms
7,864 KB
testcase_27 AC 189 ms
7,952 KB
testcase_28 AC 168 ms
7,812 KB
testcase_29 AC 17 ms
7,864 KB
testcase_30 AC 18 ms
7,856 KB
testcase_31 AC 17 ms
7,804 KB
testcase_32 AC 19 ms
7,940 KB
testcase_33 AC 17 ms
7,832 KB
testcase_34 AC 17 ms
7,784 KB
testcase_35 AC 18 ms
7,792 KB
testcase_36 AC 18 ms
7,924 KB
testcase_37 AC 17 ms
7,812 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