結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
silversmith
|
| 提出日時 | 2019-05-01 21:07:18 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 348 ms / 2,000 ms |
| コード長 | 421 bytes |
| コンパイル時間 | 410 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-12-31 12:40:46 |
| 合計ジャッジ時間 | 6,994 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
T, B = map(int,input().split())
N = [int(input()) for l in range(T)]
plusB = -B
for t in N:
a = []
sign = 1
while t != 0:
if sign > 0:
a.append(t % plusB)
t = (t - a[-1]) / plusB
else:
a.append(-t % plusB)
t = (t +a[-1]) / plusB
sign *=-1
if len(a) == 0:
print(0)
else:
print(''.join(map(str,map(int,a[::-1]))))
silversmith