結果

問題 No.782 マイナス進数
ユーザー kohei2019kohei2019
提出日時 2022-04-09 12:19:00
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 606 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 86,632 KB
実行使用メモリ 79,328 KB
最終ジャッジ日時 2023-08-19 16:06:52
合計ジャッジ時間 9,401 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,136 KB
testcase_01 AC 69 ms
71,316 KB
testcase_02 AC 217 ms
77,996 KB
testcase_03 AC 141 ms
77,708 KB
testcase_04 AC 143 ms
77,964 KB
testcase_05 AC 143 ms
77,780 KB
testcase_06 AC 141 ms
77,656 KB
testcase_07 AC 146 ms
77,832 KB
testcase_08 AC 142 ms
78,004 KB
testcase_09 AC 151 ms
77,504 KB
testcase_10 AC 147 ms
77,504 KB
testcase_11 AC 149 ms
78,560 KB
testcase_12 AC 143 ms
77,864 KB
testcase_13 AC 157 ms
78,224 KB
testcase_14 AC 145 ms
77,740 KB
testcase_15 AC 145 ms
77,900 KB
testcase_16 AC 144 ms
77,916 KB
testcase_17 AC 153 ms
78,456 KB
testcase_18 AC 143 ms
77,760 KB
testcase_19 AC 147 ms
77,980 KB
testcase_20 AC 149 ms
78,484 KB
testcase_21 AC 154 ms
78,404 KB
testcase_22 AC 147 ms
77,820 KB
testcase_23 AC 143 ms
77,848 KB
testcase_24 AC 160 ms
78,308 KB
testcase_25 AC 142 ms
77,924 KB
testcase_26 AC 147 ms
77,940 KB
testcase_27 AC 144 ms
77,956 KB
testcase_28 AC 143 ms
77,924 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

T,B = map(int,input().split())
A = abs(B)
for i in range(T):
    N = int(input())
    ls = []
    while N > 0:
        ls.append(N%A)
        N //= A
    ls2 = [0]*40
    for j in range(len(ls)):
        ls2[j] = ls[j]
    for j in range(39):
        if j % 2 == 0:
            ls2[j+1] += ls2[j]//A
            ls2[j] = ls2[j]%A
        else:
            ls2[j+1] += ls2[j]//A
            ls2[j] = ls2[j]%A
            if not ls2[j]==0:
                ls2[j] = A-ls2[j]
                ls2[j+1] += 1
    while ls2[-1] == 0:
        ls2.pop()
    ls2.reverse()
    print(*ls2,sep='')
            
        
0