当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
zabbix添加监控主机和自定义监控项
全面深入了解什么是反向代理和负载均衡
Jackson的ObjectMapper在项目中的主要运用
MySQL数据库初体验
自定义训练,使用Generator dataset迭代数据报错
The so-called software testing ability is actually these 5 points
Shell 文本三剑客 awk
maya图片如何导入
mindspore gpu版本安装问题
Take you to an in-depth understanding of the version update of 3.4.2, what does it bring to users?
随机推荐
Difference between netstat and ss command
软件测试这些基本类型你知道吗?
TCP协议之《TSQ控制》
一种能让大型数据聚类快2000倍的方法,真不戳
electron 应用开发优秀实践
TCP协议之《对端MSS值估算》
长沙:借网红的风,铺长红的路
Spark面试问题总结
The so-called software testing ability is actually these 5 points
c语言:通讯录(动态版本)
Qt 线程常用同步方式
【Mindspore】【310推理】导入mindir文件出错
program internationalization
线程执行测试效果
MindSpore官方RandomChoiceWithMask算子用例报错
TCP协议之《ACK报文限速》
【Verilog数字系统设计(夏雨闻)5-------模块的结构、数据类型、变量和基本运算符号1】
Haproxy搭建Web群集
TCP协议之《发送缓存控制tcp_notsent_lowat》
TCP协议之《延迟ACCEPT》