結果
| 問題 |
No.782 マイナス進数
|
| ユーザー |
沙耶花
|
| 提出日時 | 2022-07-30 17:25:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 517 bytes |
| コンパイル時間 | 4,228 ms |
| コンパイル使用メモリ | 251,264 KB |
| 最終ジャッジ日時 | 2025-01-30 16:49:03 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000
int main() {
int t,b;
cin>>t>>b;
rep(_,t){
int n;
cin>>n;
string ans = "";
while(n!=0){
int c = 0;
while(n%b!=0){
c++;
n--;
}
n /= b;
ans += '0' + c;
}
reverse(ans.begin(),ans.end());
if(ans.size()==0)ans = "0";
cout<<ans<<endl;
}
return 0;
}
沙耶花