結果

問題 No.782 マイナス進数
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-03-18 23:50:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 8,020 KB
最終ジャッジ日時 2023-09-26 14:03:50
合計ジャッジ時間 6,176 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,844 KB
testcase_01 AC 15 ms
7,828 KB
testcase_02 AC 109 ms
7,788 KB
testcase_03 AC 120 ms
7,752 KB
testcase_04 AC 135 ms
7,820 KB
testcase_05 AC 113 ms
7,748 KB
testcase_06 AC 108 ms
7,748 KB
testcase_07 AC 163 ms
7,812 KB
testcase_08 AC 117 ms
7,820 KB
testcase_09 AC 109 ms
7,912 KB
testcase_10 AC 109 ms
7,824 KB
testcase_11 AC 158 ms
7,780 KB
testcase_12 AC 144 ms
7,972 KB
testcase_13 AC 254 ms
7,800 KB
testcase_14 AC 148 ms
7,828 KB
testcase_15 AC 156 ms
7,824 KB
testcase_16 AC 146 ms
7,804 KB
testcase_17 AC 200 ms
7,824 KB
testcase_18 AC 145 ms
7,816 KB
testcase_19 AC 177 ms
7,820 KB
testcase_20 AC 146 ms
7,856 KB
testcase_21 AC 191 ms
7,820 KB
testcase_22 AC 152 ms
7,844 KB
testcase_23 AC 137 ms
7,844 KB
testcase_24 AC 253 ms
7,788 KB
testcase_25 AC 146 ms
7,832 KB
testcase_26 AC 169 ms
7,832 KB
testcase_27 AC 156 ms
7,904 KB
testcase_28 AC 142 ms
7,800 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for i in range(T):
    n = int(input())
    ans = []
    t = B
    while n!=0: 
        p = n % t
        if p >= 0:
            ans.append( n % t )
            n //= t
        else:
            ans.append( n % t - t )
            n = (n//t)+1
        
        # t *= B
    ans = list(reversed(ans))
    ans = list(map(str, ans))
    print("".join(ans))
            
        
0