OpenJudge - 16:Maximum Sum Not Exceeding K
描述
Given N numbers, find two different numbers from them such that the sum of the two numbers is maximum but not exceeding K.
输入
First line: two positive integers N (N <= 1000) and K (K <= 1000000).
Second line: N positive integers (<= 1000000).
输出
Two integers.
翻译:给出N个数,找到两个不同的数,使得这两个数的和最大并且不超过K。
输入:
第一行:两个正整数N和K
第二行:N个正整数。
输出:
两个数。
该问题是一个经典的算法问题,目标是从给定的一组数中找出两个不同的数,使它们的和最大且不超过一个特定值K。输入包含两行,第一行是正整数N和K,第二行是N个正整数。输出是满足条件的两个数。
2557

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



