#T585. 寻找两数和
寻找两数和
Description
Given a non-decreasing integer sequence and an integer , determine whether there exist two numbers in the sequence whose sum equals . If such a pair exists, output <span>”YES”</span>; otherwise, output <span>”NO”</span>.
Input Format
There are multiple test cases. For each test case:
- The first line contains two integers, and (where and are both less than 100,000), representing the number of elements in the integer sequence and the target sum , respectively.
- The second line contains integers, to , separated by spaces. The sequence satisfies $1 \leq a_1 \leq a_2 \leq \dots \leq a_{n-1} \leq a_n < 2^{31}$.
- The input ends with
0.
Output Format
For each test case, output a single line containing either <span>YES</span> or <span>NO</span>.
5 10
1 2 3 4 5
6 12
1 3 5 7 9 11
0 0
NO
YES
## Source
CodesOnline