結果

問題 No.782 マイナス進数
ユーザー risujirohrisujiroh
提出日時 2019-01-11 21:57:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 164,544 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 05:56:19
合計ジャッジ時間 3,401 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 14 ms
4,376 KB
testcase_14 AC 7 ms
4,376 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 AC 7 ms
4,380 KB
testcase_17 AC 10 ms
4,380 KB
testcase_18 AC 7 ms
4,376 KB
testcase_19 AC 9 ms
4,376 KB
testcase_20 AC 6 ms
4,376 KB
testcase_21 AC 10 ms
4,376 KB
testcase_22 AC 7 ms
4,380 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 14 ms
4,376 KB
testcase_25 AC 7 ms
4,380 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 7 ms
4,376 KB
testcase_28 AC 7 ms
4,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
  }
}
0