OpenJudge - 26:The Nearest Number
描述
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.
输入
First line: two positive integers N (N <= 100) and K (K <= 100000).
Second line: N positive integers (<= 100000).
输出
One integer X.
翻译:给出一个有N个数的序列和K,找到最接近的X个数(X-K)。
输入:
第一行:两个正整数N和K。
第二行;N个正整数。
输出:
一个数X。
该问题描述了一个算法挑战,输入为一个包含N个正整数的序列和一个正整数K,目标是找出序列中与K绝对差值最小的数。程序需要返回这个最接近的数。
5583

被折叠的 条评论
为什么被折叠?



