0分求教
查看原帖
0分求教
601167
PH13楼主2024/10/7 16:33
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long

using namespace std;

ll n;
int r;
char a[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char b[]="";

int main(){
	scanf("%lld%d", &n, &r);
	int cnt = 0;
	while(n > 0){
		int i = n % r;
		b[cnt++] = a[i];
		n /= r;
	}
	for(int i=cnt-1; i>=0; i--){
		printf("%c", b[i]);
	}
	return 0;
}

为啥样例能过,我自己敲的转16进制的也能过,提交就全wa啊

2024/10/7 16:33
加载中...