5 条题解

  • 0
    @ 2025-3-18 20:42:32
    #include <bits/stdc++.h>
    #define endl '\n'
    using namespace std;
    typedef pair<int,int> aII;  
    using ll = long long;
    using ULL = unsigned long long;
    const int N = 1e6+5;
    
    ll m;
    string n;
    inline void solve() { 
        cin >> n >> m;
        ll res = 0;
        for (auto &i: n) {
            res = res * m + (isdigit(i)? i - '0' : i - 'A' + 10);
        }
        cout << res << endl;
    }
    int main() { 
        ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        int _ = 1; 
        //int _; cin >> _;
        while (_--) solve();
        return 0;
    }
    

    信息

    ID
    96
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    407
    已通过
    187
    上传者