結果
問題 |
No.782 マイナス進数
|
ユーザー |
![]() |
提出日時 | 2019-08-07 17:32:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 284 bytes |
コンパイル時間 | 1,534 ms |
コンパイル使用メモリ | 168,204 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 18:45:05 |
合計ジャッジ時間 | 4,491 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 36 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int t,b; cin>>t>>b; while(t--){ int N;cin >> N; string S = ""; while(N){ if(N % b){ N--; S = (char)('0'+N%b) + S; } else{ S = '0' + S; } N /= -b; } if(S=="") cout<<0; cout << S << endl; } }