結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-11 22:02:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 500 bytes |
| コンパイル時間 | 1,426 ms |
| コンパイル使用メモリ | 167,184 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 06:53:17 |
| 合計ジャッジ時間 | 3,108 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int T, B;
cin >> T >> B;
for (int i = 0; i < T; i++) {
ll n;
cin >> n;
string ans = "";
while (n != 0) {
int d = ((n % -B) - B) % -B;
n -= d;
ans += (char)('0' + d);
n /= B;
}
reverse(ans.begin(), ans.end());
cout << ans << endl;
}
return 0;
}