为什么90
查看原帖
为什么90
1473266
Andy0121楼主2024/10/6 22:04

方法有些独特 但为什么是90呢

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,t = 0,c = 0;
	cin >> n;
	string m;
	cin >> m;
	int a[36] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	for(int i = m.length() - 1;i >= 0;i--){
		for(int j = 0;j < n;j++){
			if(m[i] == a[j]) t += j*pow(n,c);
		}
		c++;
	}
	cout << t;
	return 0;
}
2024/10/6 22:04
加载中...