結果
問題 |
No.782 マイナス進数
|
ユーザー |
![]() |
提出日時 | 2024-02-09 18:46:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 487 bytes |
コンパイル時間 | 1,924 ms |
コンパイル使用メモリ | 192,772 KB |
最終ジャッジ日時 | 2025-02-19 03:04:46 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll T, B, N; cin >> T >> B; while(T--){ cin >> N; ll x; string s=""; while(N!=0){ x = N%B; if (x < 0) x -= B; s += char('0'+x); N -= x; N /= B; } reverse(s.begin(), s.end()); cout << s << endl; } return 0; }