結果

問題 No.2865 Base 10 Subsets 2
ユーザー nu50218nu50218
提出日時 2024-08-30 21:26:45
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 926 bytes
コンパイル時間 4,217 ms
コンパイル使用メモリ 293,224 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-08-30 21:26:51
合計ジャッジ時間 4,616 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,948 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#pragma GCC optimize("O3")
// #pragma target("arch=skylake-avx512")
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#endif

using namespace std;
using ll = long long;
using ld = long double;

void solve(int) {
    string N;
    cin >> N;

    vector<ll> num;
    for (int i = 0; i < (int)N.size(); i++) {
        num.push_back(N[i] - '0' + 1);
    }
    reverse(num.begin(), num.end());

    debug(num);

    ll K;
    cin >> K;
    K -= 1;

    vector<ll> ans;

    for (auto&& x : num) {
        ans.push_back(K % x);
        K /= x;
        if (K == 0) break;
    }
    reverse(ans.begin(), ans.end());

    for (auto&& x : ans) {
        cout << x;
    }
    cout << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

#ifdef LOCAL
    postprocess();
#endif
}
0