$进制转换,先转换成十进制后相乘后转换回p进制$
代码如下
#include<bits/stdc++.h>
using namespace std;
int p;
string get(int x){
string ans;
while(x){
int t = x%p;
if(t<10) ans+='0'+t;
else ans+='A'+t-10;
x/=p;
}
reverse(ans.begin(),ans.end());
return ans;
}
string get(int x,int y){
int a = 0,b = 0;
while(x){
a = a*p + x%p;
x/=p;
}
while(y){
b = b*p + y%p;
y/=p;
}
return get(a*b);
}
int main(){
cin>>p;
for(int i=1;i<p;i++){
for(int j=1;j<=i;j++){
cout<<get(i)<<"*"<<get(j)<<"="<<get(i,j)<<" ";
}
printf("\n");
}
return 0;
}
你的get(i,j)函数存在的意义是啥
转化成十进制