結果

問題 No.2087 基数の変換
ユーザー Hydrogen332
提出日時 2024-10-31 01:11:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 2,069 ms
コンパイル使用メモリ 194,068 KB
最終ジャッジ日時 2025-02-25 01:54:26
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    cin.tie(nullptr);
    
    int N, M;
    cin >> N >> M;
    
    if (M == 0) {
        cout << 0 << '\n';
        return 0;
    }
    
    vector<int> res;
    while (M > 0) {
        res.push_back(M % N);
        M /= N;
    }
    
    int siz = res.size();
    
    rep(i, 0, siz) cout << res[siz - i - 1];
    cout << '\n';
}
0