結果
問題 | No.782 マイナス進数 |
ユーザー |
|
提出日時 | 2019-01-11 23:18:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 1,572 ms |
コンパイル使用メモリ | 169,044 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 13:26:28 |
合計ジャッジ時間 | 3,279 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h>int main(){int T;int B;std::cin>>T;std::cin>>B;for(int i=0;i<T;++i){int N;std::cin>>N;if(N==0){std::cout<<0<<std::endl;continue;}std::string ans="";while(N!=0){int add=N%B;while(add<0)add-=B;ans=std::to_string(add)+ans;N-=add;N/=B;}std::cout<<ans<<std::endl;}return 0;}