結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2019-01-11 21:57:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 808 bytes |
| コンパイル時間 | 1,553 ms |
| コンパイル使用メモリ | 168,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-30 06:16:35 |
| 合計ジャッジ時間 | 3,051 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }
int emod(int x, int p) { return (x % p + p) % p; }
int main() {
cin.tie(nullptr); ios_base::sync_with_stdio(false);
int t, b; cin >> t >> b;
while (t--) {
int n; cin >> n;
string res;
while (n) {
res += '0' + emod(n, -b);
n = (n - emod(n, -b)) / b;
}
reverse(begin(res), end(res));
cout << res << '\n';
}
}
risujiroh