0
点赞
收藏
分享

微信扫一扫

Maximum Sum Not Exceeding K1.27

向上的萝卜白菜 2022-01-30 阅读 28
c++

OpenJudge - 16:Maximum Sum Not Exceeding K

描述

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.

样例输入

5 14
2 4 7 3 9

样例输出

4 9

描述

找出两个不同的数,使这两个数的和是最大的,但不超过K

输入

第一行: 俩个正整数 N (N <= 1000) 和K (K <= 1000000).
第二行: N 个正整数 (<= 1000000).

输出

两个整数

举报

相关推荐

0 条评论