結果
| 問題 | No.782 マイナス進数 |
| コンテスト | |
| ユーザー |
silversmith
|
| 提出日時 | 2019-05-01 21:07:18 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 184 ms / 2,000 ms |
| + 208µs | |
| コード長 | 421 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2026-10-09 22:58:54 |
| 合計ジャッジ時間 | 5,025 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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