結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2019-01-11 21:51:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 616 bytes |
| コンパイル時間 | 562 ms |
| コンパイル使用メモリ | 72,948 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 05:56:11 |
| 合計ジャッジ時間 | 1,800 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 9 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t, b;
cin >> t >> b;
b *= -1;
char c[256] = {};
for (int h = 0; h < t; h++) {
int n;
cin >> n;
int i = 255;
c[i] = 0;
while (n) {
int r = n % b;
if (r < 0) n -= b, r += b;
c[--i] = r + '0';
n /= -b;
}
cout << c + i << '\n';
}
return 0;
}
merom686