CF22A.Second Order Statistics

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. Help Bob solve this problem.

曾经,Bob 需要求一个整数序列的第二顺序统计量。我们从该序列中每个数恰好选取一次,并将它们排序。排在第二位的数值即为该序列的第二顺序统计量。换言之,它就是严格大于最小值的最小元素。请帮助 Bob 解决这个问题。

输入格式

The first input line contains integer n (1 ≤ n ≤ 100) — amount of numbers in the sequence. The second line contains n space-separated integer numbers — elements of the sequence. These numbers don't exceed 100 in absolute value.

第一行输入包含一个整数 nn(1≤n≤1001 \leq n \leq 100)—— 序列中数字的个数。
第二行包含 nn 个以空格分隔的整数——序列的元素。这些数字的绝对值不超过 100100。

输出格式

If the given sequence has the second order statistics, output this order statistics, otherwise output NO.

如果给定序列存在二阶统计量,则输出该二阶统计量;否则输出 NO。

输入输出样例

  • 输入#1

    4
    1 2 2 -4

    输出#1

    1
  • 输入#2

    5
    1 2 3 1 1

    输出#2

    2

输入解题思路,AI测评打分。不知道怎么写?

首页