結果

問題 No.782 マイナス進数
ユーザー vwxyz
提出日時 2024-04-06 05:51:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-01 03:44:21
合計ジャッジ時間 6,213 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

T,B=map(int,input().split())
for t in range(T):
    N=int(input())
    ans_lst=[]
    while N:
        ans_lst.append(N%(-B))
        N-=ans_lst[-1]
        N//=B
    if not ans_lst:
        ans_lst.append(0)
    print(*ans_lst[::-1],sep="")
0