結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    int n, m;
    cin >> n >> m;
    if (m == 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<int> ans;
    while (m) {
        ans.push_back(m % n);
        m /= n;
    }
    reverse(ans.begin(), ans.end());
    for (int a : ans) {
        cout << a;
    }
    cout << endl;
}
0