結果

問題 No.782 マイナス進数
ユーザー potoooooooo
提出日時 2019-01-29 23:48:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 171,692 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 01:34:31
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int t, b; cin >> t >> b;
    for (int ti = 0; ti < t; ti++) {
        int n; cin >> n;
        deque<int> v;
        while (n) {
            int c = (n % b < 0) ? (n % b + abs(b)) : (n % b);
            n -= c;
            v.push_front(c);
            n /= b;
        }
        for (int i = 0; i < v.size(); i++) {
            cout << v[i];
        }
        cout << endl;
    }
}
0