結果

問題 No.2087 基数の変換
ユーザー tabae326tabae326
提出日時 2022-09-30 21:30:09
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,781 bytes
コンパイル時間 4,013 ms
コンパイル使用メモリ 261,296 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 14:47:37
合計ジャッジ時間 5,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 1 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 2 ms
4,376 KB
testcase_49 AC 2 ms
4,384 KB
testcase_50 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using pl = std::pair<long long, long long>;
using mint = atcoder::modint1000000007;
//using mint = atcoder::modint998244353;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define all(v) (v).begin(), (v).end()
#define dump(var)  do{ if(debug::enable) { std::cerr << #var << " : "; debug::print(var); } } while(0);
constexpr int di[4] = {1, -1, 0, 0};
constexpr int dj[4] = {0, 0, 1, -1};
constexpr long long inf = 1LL<<60;
template<typename T> inline void chmax(T &a, T b) { a = std::max(a, b); };
template<typename T> inline void chmin(T &a, T b) { a = std::min(a, b); };
template<typename T> void vprint(const std::vector<T>& v) { for(int i = 0; i < v.size(); i++) { std::cout << v[i] << (i == v.size()-1 ? "\n" : " "); } }
template<typename T> void vprintln(const std::vector<T>& v) { for(int i = 0; i < v.size(); i++) { std::cout << v[i] << "\n"; } }
template<int M> void vprint(const std::vector<atcoder::static_modint<M>>& v) { for(int i = 0; i < v.size(); i++) { std::cout << v[i].val() << (i == v.size()-1 ? "\n" : " "); } }
template<int M> void vprintln(const std::vector<atcoder::static_modint<M>>& v) { for(int i = 0; i < v.size(); i++) { std::cout << v[i].val() << "\n"; } }
namespace debug {    
    #if defined(ONLINE_JUDGE)
    const bool enable = false;
    #else
    const bool enable = true;
    #endif
    template<typename T> void push(const T& e) { std::cerr << e; }
    template<int M> void push(const atcoder::static_modint<M>& e) { std::cerr << e.val(); }
    template<typename T1, typename T2> void push(const std::pair<T1, T2>& e) { std::cerr << "("; push(e.first); std::cerr << ","; push(e.second); std::cerr << ")"; }   
    template<typename T1, typename T2, typename T3> void push(const std::tuple<T1, T2, T3>& e) { std::cerr << "("; push(get<0>(e)); std::cerr << ","; push(get<1>(e)); std::cerr << ","; push(get<2>(e)); std::cerr << ")"; }   
    template<typename T> void print(const T& e) { push(e); std::cerr << "\n"; }
    template<typename T> void print(const std::vector<T>& v) { for(int i = 0; i < v.size(); i++) { push(v[i]); std::cerr << " "; } std::cerr << "\n"; }
    template<typename T> void print(const std::vector<std::vector<T>>& v) { std::cerr << "\n"; for(int i = 0; i < v.size(); i++) { std::cerr << i << ": "; print(v[i]); } }
};

void solve() {
    ll n, m;
    cin >> n >> m;
    if(m == 0) {
        cout << 0 << endl;
        return;
    }
    string ans;
    while(m) {
        ans.push_back((m % n) + '0');
        m /= n;
    }
    reverse(all(ans));
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
0