当前位置:网站首页>Wonderful coding [hexadecimal conversion]
Wonderful coding [hexadecimal conversion]
2022-07-06 19:49:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
Wonderful coding Description If there are no Arabic numerals , We want to figure out how to represent numbers Xiao Ming thinks a way , Like the one below : 1 -> A 2 -> B 3 -> C …. 25 -> Y 26 -> Z 27 -> AA
28 -> AB ….
Now please write a program to complete this conversion
Input The first number entered is a positive integer T, Indicates that there is T Group data . Each group of data is a positive integer n ( n <= 1000)
Output For every positive integer n, Output his corresponding string
Sample Input 3 1 10 27 Sample Output A J AA
Hexadecimal conversion ?
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <queue>
#include <stack>
#include <set>
#include <sstream>
#include <time.h>
#include <utility>
#include <malloc.h>
#include <stdexcept>
#include <iomanip>
#include <iterator>
using namespace std;
int main()
{
int n,t;
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
if (n <= 26)
printf("%c\n", 'A' + n - 1);
else if (n <= 26 * 26 + 26)
{
n -= 27;
int t = n / 26;
printf("%c", 'A' + t);
n = n % 26;
printf("%c\n", 'A' + n);
}
else
{
n -= 27 + 26 * 26;
printf("%c%c%c\n", 'A' + char(n / 26 / 26), 'A' + char((n / 26) % 26), 'A' + char(n % 26));
}
}
return 0;
}Copyright notice : Reprint please indicate the source .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117143.html Link to the original text :https://javaforall.cn
边栏推荐
- Test Li hi
- Finally, there is no need to change a line of code! Shardingsphere native driver comes out
- A5000 vGPU显示模式切换
- RT-Thread 组件 FinSH 使用时遇到的问题
- 从sparse.csc.csr_matrix生成邻接矩阵
- 理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
- Mysql Information Schema 學習(一)--通用錶
- Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
- VMware virtual machine cannot open the kernel device "\.\global\vmx86"
- POJ 3207 Ikki&#39;s Story IV – Panda&#39;s Trick (2-SAT)
猜你喜欢
腾讯T2大牛亲自讲解,跳槽薪资翻倍

手把手教你学会js的原型与原型链,猴子都能看懂的教程

Cesium 点击绘制圆形(动态绘制圆形)

Blue Bridge Cup microbial proliferation C language

Mysql Information Schema 学习(二)--Innodb表

Configuration and simple usage of the EXE backdoor generation tool quasar
腾讯T4架构师,android面试基础

Phoenix Architecture 3 - transaction processing

ZABBIX proxy server and ZABBIX SNMP monitoring

LeetCode_双指针_中等_61. 旋转链表
随机推荐
JDBC details
MySQL information schema learning (II) -- InnoDB table
句号压缩过滤器
信息系统项目管理师---第八章 项目质量管理
Cf960g - bandit Blues (type I Stirling number +ogf)
2022年6月语音合成(TTS)和语音识别(ASR)论文月报
Li Kou 101: symmetric binary tree
AddressSanitizer 技术初体验
小微企业难做账?智能代账小工具快用起来
LeetCode_格雷编码_中等_89.格雷编码
logstash高速入口
[translation] supply chain security project in toto moved to CNCF incubator
Application of clock wheel in RPC
MySQL information schema learning (I) -- general table
凤凰架构2——访问远程服务
POJ1149 PIGS 【最大流量】
Chic Lang: attributeerror: partially initialized module 'CV2' has no attribute 'GAPI_ wip_ gst_ GStreamerPipe
POJ3617 Best Cow Line 馋
MySQL information Schema Learning (i) - - General table
Learning and Exploration - Seamless rotation map