很简单的
#include<iostream>
#include<string>
using namespace std;
int dec(int x,int y)
{
int k=1,sum1=0;
while(x)
{
sum1 += (x%10)*k;
x/=10;
k*=y;
}
return sum1;
}
int main()
{
int N,a,dex;
long long int sum;
while(cin>>N)
{
sum = 0;
for(int i=1;i<=N;i++)
{
scanf("%d(%d)",&a,&dex);//
sum += dec(a,dex);
}
cout<<sum<<endl;
}
}
转换