当前位置:网站首页>ZZULIOJ:1022: 三整数排序
ZZULIOJ:1022: 三整数排序
2022-08-10 03:39:00 【追上】
1022: 三整数排序
时间限制: 1 Sec 内存限制: 30 MB
[状态] [讨论版] [提交] [命题人:admin]
题目描述
从键盘输入三个整数x,y和z,按从大到小的顺序输出它们的值。
输入
输入三个整数x,y和z。
输出
按从大到小的顺序输出它们的值。
样例输入 Copy
20 16 18样例输出 Copy
20 18 16提示
本题在在线开放课程里有专题讲解: 第三章的边讲见写:三个整数排序——变量交换内容、擂台赛思想
https://www.icourse163.org/learn/ZZULI-1206704833?tid=1465320443#/learn/content?type=detail&id=1245589817&cid=1270746309
还有一个关于调试方法的专题:一起调试程序——以三个整数排序为例:
https://www.icourse163.org/learn/ZZULI-1206704833?tid=1465320443#/learn/content?type=detail&id=1245607811&cid=1270752176
参考代码
#include <stdio.h>
#include <math.h>
int main()
{
int a, b, c, t;
scanf("%d %d %d", &a, &b, &c);
if(a<b)
{
t=a;
a=b;
b=t;
}
if(a<c)
{
t=a;
a=c;
c=t;
}
if(b<c)
{
t=b;
b=c;
c=t;
}
printf("%d %d %d", a, b, c);
return 0;
}边栏推荐
猜你喜欢

电话自动拨号在电脑上自动拨打

什么是Jmeter?Jmeter使用的原理步骤是什么?

超全面的Android面试题汇总

【2022河南萌新联赛第(五)场:信息工程大学】【部分思路题解+代码解析】

【科研绘图】琴图 +箱型图混合 matplotlib库和seabsorn库的使用

It's almost 35, still "did a little"?What happened to the test workers who had been in the industry for a few years?

同样是初级测试,凭什么他比我薪资高 5000 块?

Recommend several easy-to-use MySQL open source clients, it is recommended to collect

2022年起重机械指挥操作证考试题库及模拟考试

Evaluation and Construction of Enterprise Network Security Capability from the Sliding Ruler Model
随机推荐
Embedded Sharing Collection 32
TCP协议之《对端MSS值估算》
applet wxs
进入Mysql数据库操作
How to quickly become a software test engineer?What skills do testers need for a monthly salary of 15k?
线程和线程间通信(C语言)
GBase 8s打开工具就报错“配置文件有误” !!!为什么
如何将 @Transactional 事务注解运用到炉火纯青?
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
How does a new tester do functional testing?Test thinking is really important
[STL]map与set
继承关系下构造方法的访问特点
【单调栈】【概念讲解&&模板代码】
It's almost 35, still "did a little"?What happened to the test workers who had been in the industry for a few years?
电话自动拨号在电脑上自动拨打
互联网公司高频面试题精讲:测试计划和测试方案有什么区别?
测试工作管理与规范
js原型和原型链以及原型继承
wind7 无法安装tools (问题已解决)
mysqldump和XBK备份