1180:5个数求最值
来源:互联网 发布:泰迪罗宾地位知乎 编辑:程序博客网 时间:2024/06/01 17:00
1180:5个数求最值
Description
设计一个从5个整数中取最小数和最大数的程序
Input
输入只有一组测试数据,为五个不大于1万的正整数
Output
输出两个数,第一个为这五个数中的最小值,第二个为这五个数中的最大值,两个数字以空格格开。
Sample Input
1 2 3 4 5
Sample Output
1 5
#include<iostream>using namespace std;int main(){ int a[1000]; int i,j; for(i=0;i<5;i++) cin>>a[i]; int index,temp; for(i=0;i<4;i++) { index=i; for(j=i+1;j<5;j++) { if(a[index]>a[j]) index=j; } if(index!=i) { temp=a[i];a[i]=a[index];a[index]=temp; } } cout<<a[0]<<" "<<a[4]; return 0;}
阅读全文
0 0
- 1180: 5个数求最值
- 1180:5个数求最值
- 5个数求最值
- NYOJ - 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- 5个数求最值
- NYOJ31 5个数求最值
- 5个数求最值
- (31)5个数求最值
- 5个数求最值
- 31 5个数求最值
- nyoj 5个数求最值
- NYOJ-5个数求最值
- 排序
- uboot的eMMC初始化代码流程分析
- 当类的属性被static final修饰时需要注意的问题
- 什么是 JWT -- JSON WEB TOKEN
- Java多线程
- 1180:5个数求最值
- Selector 实现原理
- OPNET网络仿真分析-1.1.1、网络仿真简介
- 【云周刊】第139期:阿里年会黑科技全揭秘:IoT手环、人脸识别验票、大屏弹幕互动等“十八般武艺”轮番上阵
- springMVC页面参数的接收
- Unit Test -- 初步了解
- Logtail技术分享(一) : Polling + Inotify 组合下的日志保序采集方案
- linux C 生成带有格式的文件 wkhtmltopdf(类似word的效果 有颜色 字体等等)
- 欢迎使用CSDN-markdown编辑器