結果

問題 No.782 マイナス進数
ユーザー pluto77pluto77
提出日時 2019-01-13 09:01:38
言語 Python2
(2.7.18)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-12-24 15:55:43
合計ジャッジ時間 5,566 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki782

t,b=map(int,raw_input().split())
for i in xrange(t):
 n=int(raw_input())
 if n==0:
  print 0
 else:
  res=''
  while n:
   if n%(-b):
    res+=str(n%(-b))
    n-=n%(-b)
   else:
    res+='0'
   n/=b
  print res[::-1]
0