求助40分
查看原帖
求助40分
890311
xiaoyang111楼主2023/7/9 20:00
#include <iostream>
#include <cmath>
#define int long long
using namespace std;
const int N=1000+5;
string func1(long long n,long long x){
	char a[N]={'\0'};
	int i=0;
	string hash_string("0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZ");
	while (n){
		int t=n%x;
		a[i++]=hash_string[t];
		n/=x;
	}
	string str;
	for (int j=i-1;j>=0;--j){
		str=str+a[j];
	}
	return str;
}
signed main(){
	long long p;
	cin >> p;
	for (long long i=1;i<p;++i){
		for (long long j=1;j<=i;++j){
			string str=func1(i*j,p);
			string str1=func1(i,p);
			string str2=func1(j,p);
			cout<<str1<<"*"<<str2<<"="<<str<<" ";
		}
		cout<<"\n";
	}
	return 0;
}

QAQ

2023/7/9 20:00
加载中...