You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
int p, q, n;
|
|
|
|
|
cin >> p >> n >> q;
|
|
|
|
|
//<2F>ֽ<EFBFBD>P<EFBFBD><50><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊʮ<CEAA><CAAE><EFBFBD><EFBFBD>
|
|
|
|
|
int t = 0, f = 1;
|
|
|
|
|
while (n != 0) {
|
|
|
|
|
t = (n % 10) * f + t;
|
|
|
|
|
f = f * p;
|
|
|
|
|
n = n / 10;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>ڽ<EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>ΪQ<CEAA><51><EFBFBD><EFBFBD>
|
|
|
|
|
int y[100], num = 0;
|
|
|
|
|
do {
|
|
|
|
|
y[num++] = t % q;
|
|
|
|
|
t = t / q;
|
|
|
|
|
} while (t != 0);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for (int i = num - 1; i >= 0; i--) {
|
|
|
|
|
cout << y[i];
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|