結果
問題 |
No.782 マイナス進数
|
ユーザー |
![]() |
提出日時 | 2023-08-26 19:57:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 530 bytes |
コンパイル時間 | 915 ms |
コンパイル使用メモリ | 69,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 21:42:33 |
合計ジャッジ時間 | 4,051 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 WA * 9 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ int t, b; cin >> t >> b; while(t--){ int n; cin >> n; vector<int> ans; while(n != 0){ int p = n/b; int r = n%b; if(r < 0){ r -= b; p += 1; } ans.emplace_back(r); n = p; } while(!ans.empty()){ cout << ans.back(); ans.pop_back(); } cout << '\n'; } return 0; }