当前位置:网站首页>Noi OJ 1.3 13: reverse output of a three digit C language
Noi OJ 1.3 13: reverse output of a three digit C language
2022-06-23 10:29:00 【chd44】
describe
Invert a three digit output .
Input
A three digit number n.
Output
Reverse output n.
This kind of question is not difficult , But thinking should be flexible , Here are two ideas .
Method 1: First find the number of hundreds , Remove one more bit , Find out the ten digits , Finally, subtract the hundreds and tens from the original number , Get single digits , One by one ( Stupid way ).
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
int b=a/100;
int c=a/10-b*10;
int d=a-c*10-b*100;
printf("%d%d%d",d,c,b);
return 0;
}Method 2: Find a bit in the way of remainder , The ten bits are divided by an integer 10 After seeking remainder , Direct division of hundreds 100 Just go ( A slightly smarter approach )
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d",&a);
b=a%10;
c=(a/10)%10;
d=a/100;
printf("%d%d%d",b,c,d);
return 0;
}边栏推荐
- thymeleaf中如何给onclick事件传值的方法
- R and rstudio download and install detailed steps
- 圖片存儲--引用
- 文献综述怎么写 ,一直没头绪写不出来怎么办?
- NOI OJ 1.3 05:计算分数的浮点数值 C语言
- 线程池在项目中使用的心得体会
- Mysql-03.工作中对SQL优化的心得体会
- Data structures and differences between MySQL InnoDB engine and MyISAM
- 【第23天】给定一个长度为 n 的数组,将元素 X 插入数组指定的位置 | 数组插入操作4
- Numerical calculation method
猜你喜欢

Build the information and innovation industry ecology, and make mobile cloud based on the whole stack of independent innovation

技术创造价值,手把手教你薅羊毛篇

汇编语言中断及外部设备操作篇--06

【软件与系统安全】堆溢出

AI芯片技术-2022年

文献综述怎么写 ,一直没头绪写不出来怎么办?

2021-05-07构造器

pycharm安装教程,超详细

Personal blog system graduation project opening report

解决audio自动播放无效问题
随机推荐
实现领域驱动设计 - 使用ABP框架 - 通用准则
Unity技术手册 - 形状(Shape)子模块 - Sprite、SpriteRenderer及生命周期内速度(Velocity over Lifetime)
搭建一个点歌QQ机器人,另外还能看美女
NOI OJ 1.3 13:反向输出一个三位数 C语言
新派科技美学、原生物联网操作系统重塑全屋智能
NOI OJ 1.3 09:与圆相关的计算 C语言
Google Earth Engine(GEE)——用不同方法计算slope对比案例分析
pycharm安装教程,超详细
卧槽,最惊艳的论文神器!
Step by step introduction to sqlsugar based development framework (9) -- Realizing field permission control with WinForm control
IPv6 的速度比 IPv4 更快?
JVM easy start-02
2021-04-16 recursion
RT thread add MSH command
2021-05-11 instanceof and type conversion
STM32F1与STM32CubeIDE编程实例-红外寻迹传感器驱动
NOI OJ 1.2 整型与布尔型的转换 C语言
NOI OJ 1.3 14:大象喝水 C语言
AI芯片技术-2022年
Successful experience in postgraduate entrance examination for MTI master of English translation major of Beijing University of science and technology in 2023