#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
int m;//进制数
cin>>m;
double sum=0.0;
int k=0;
while (n!=0)
{
int a=n%10;
sum=a*pow(m,k++)+sum;
n/=10;
}
cout<<sum;
}
时间: 2025-01-02 16:54:31