結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-30 23:05:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 545 bytes |
| コンパイル時間 | 2,253 ms |
| コンパイル使用メモリ | 194,880 KB |
| 最終ジャッジ日時 | 2025-01-09 11:09:03 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 9 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
using real=long double;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint q,b;std::cin>>q>>b;b=-b;
while(q--){
lint x;std::cin>>x;
std::string s;
while(x){
lint r=x%b;
if(r<0)r+=b;
s.push_back('0'+r);
x-=r;
x/=b;
x*=-1;
}
std::cout<<std::string(s.rbegin(),s.rend())<<'\n';
}
}
ngtkana