#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<map>
#include<queue>
#include<stack>
typedef long long LL;
using namespace std;
//map<char ,int> mm;
//queue<char> Q;
char a[100];
int main()
{
int b;
stack<LL> Q;
while (cin >> a >> b)
{
LL ans = 0;
for (int i=0;a[i];i++)
{
ans *= 26;
ans += (a[i] - 'a');
}//这只是一个先转化为10进制的方法,可以随意替代
//cout << ans << endl;
while (ans)
{
Q.push(ans%b);
ans /= b;
}
int f = 0;
while (!Q.empty())
{
f = 1;
int s = Q.top();
Q.pop();
cout << s;
}
if (!f)
{
puts("0");
}
else
{
puts("");
}
}
return 0;
}
任意进制转化 c(c++)
最新推荐文章于 2023-11-30 01:20:00 发布