Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
44571 wutong 转进制 C++ Accepted 0 MS 256 KB 371 2024-03-31 12:39:23

Tests(2/2):


#include <bits/stdc++.h> using namespace std; string turn(long long x, int N, string res="") { if(x == 0) { reverse(res.begin(),res.end()); return res; } if(x%N>=10) { res += (char)(x%N-10+'A'); } else { res += (char)(x%N+'0'); } return turn(x/N,N,res); } int main() { long long x, N; cin >> x >> N; cout << turn(x, N); return 0; }


Judgement Protocol: