結果
問題 |
No.782 マイナス進数
|
ユーザー |
![]() |
提出日時 | 2019-02-15 19:06:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 1,007 ms |
コンパイル使用メモリ | 94,144 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 12:04:06 |
合計ジャッジ時間 | 3,030 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <algorithm> #include <iostream> #include <iomanip> #include <cstring> #include <string> #include <vector> #include <queue> #include <cmath> #include <stack> #include <set> #include <map> typedef long long ll; typedef unsigned int uint; using namespace std; int main() { int T, B, N; cin >> T >> B; for (int i = 0; i < T; i++) { cin >> N; string ans = ""; while (true) { int p = N / B; int q = N % B; if (q < 0) { p++; q -= B; } ans = to_string(q) + ans; if (p == 0) break; N = p; } cout << ans << "\n"; } return 0; }