codevs 1201 最小数和最大数

时间:2023-12-27 21:52:01

http://codevs.cn/problem/1201/

1201 最小数和最大数

 时间限制: 1 s
 空间限制: 128000 KB
 题目等级 : 青铜 Bronze
题目描述 Description

输入n个数,n<=100,找到其中最小的数和最大的数

输入描述 Input Description

第一行一个整数n

接下来一行n个整数,每个整数不超过231 -1

输出描述 Output Description

最小和最大的数

样例输入 Sample Input

4

1 2 3 4

样例输出 Sample Output

1 4

数据范围及提示 Data Size & Hint

分类标签 Tags 点此展开

通过11 k
提交29 k
40%
通过率
Summary
AC
41%
WA
37%
RE
21%
Other
1%
  • 120251 AC
  • 108752 WA
  • 2373 TLE
  • 94 MLE
  • 60245 RE
                         
C

C++

Pascal

C++ C Pascal

分析:
第一次做OI的题,感觉和acm不是很一样,首先oj界面比acm界面做的华丽,会有某一题的题解和数据说明,会有个人的“等级修炼”,,,还有Pascal语言,一般acm都是多个Java,还有本题的通过率显示会和WA . TLE . MLE . RE . AC放在一块,美美的~~~
codevs 1201 最小数和最大数codevs 1201 最小数和最大数codevs 1201 最小数和最大数codevs 1201 最小数和最大数codevs 1201 最小数和最大数
不多说啦,直接看题,这一题就是求最值,一般acm的oj都是a + b ,(呵呵哒)
AC代码:
 #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0); int main()
{
int n , temp;
while(~scanf("%d",&n))
{
int ma = -INF , mi = INF;
while(n --)
{
scanf("%d",&temp);
if(temp > ma)
ma = temp;
if(temp < mi)
mi = temp;
}
printf("%d %d\n",mi , ma);
}
return ;
}