結果

問題 No.782 マイナス進数
ユーザー chun1182chun1182
提出日時 2019-01-12 13:08:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-12-17 18:33:45
合計ジャッジ時間 6,593 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

t,k=map(int, input().split())
a=[int(input()) for i in range(t)]
for n in a:
    ans=''
    if n==0:ans='0'
    while n!=0:
        if n%-k==0:ans+='0'
        else:ans+=str(n%-k)
        n=-(n//-k)
    print(ans[::-1])
0