B3619 10 进制转 x 进制,求zhudalao,#8#10TLE
  • 板块题目总版
  • 楼主KFZX_xiaohao
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/1/19 16:07
  • 上次更新2024/1/19 19:25:06
查看原帖
B3619 10 进制转 x 进制,求zhudalao,#8#10TLE
1241218
KFZX_xiaohao楼主2024/1/19 16:07

https://www.luogu.com.cn/record/143357696

#include<bits/stdc++.h>
using namespace std;
int top=-1,stk[109];
int main()
{
	int n,a;
	cin>>n>>a;
	while(n>0){
        top++;
        stk[top]=n%a;
        n/=a;
	}
	while(top>=0){
        if(stk[top]<10){
            cout<<stk[top];
            top--;
        }
        else{
            cout<<char(stk[top]-10+'A');
        }
	}
}

还有,蒟蒻没懂

cout<<char(stk[top]-10+'A');

的含义

2024/1/19 16:07
加载中...