The Nearest Number(NOIOPJENGLISH26)

阅读 91

2022-02-14

The Nearest Number

https://acs.jxnu.edu.cn/problem/NOIOPJENGLISH26

1000ms 65536K

描述:

Given a sequence of N number and K. Find the nearest number X in the sequence that the absolute value of (X minus K) is minimum.

给出一个有n个数的序列和k,找到在序列中离x最近的数,并且x减去k的绝对值最小

输入:

First line: two positive integers N (N <= 100) and K (K <= 100000).
Second line: N positive integers (<= 100000).

第一行:两个正整数表示n和k

第二行:n个正整数

输出:

One integer X.

一个数表示x

样例输入:

4 5
2 4 7 8

样例输出:

4

精彩评论(0)

0 0 举报