Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Mathematics and Computer Science
判断集合中是否有两个数的和为x
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB
Total submit users: 127, Accepted users: 95
Problem 10542 : No special judgement
Problem description
  给定一个有序集合S和一个整数X,集合S中有n(n<=100000)个整数,判断集合S中是否有两个元素的和恰好等于X(x<2^31)

Input
  多组数据,第一行为数据组数T 对于每组数据,第一行有n+1个数据,第一个为n,表示集合S中元素的个数,后面n个表示集合中的元素。第二行为X。

Output
  对于每组数据,如果集合S中存在两个元素的和恰好等于X,输出”YES”,否则,输出”NO”。

Sample Input
1
10 1 6 9 12 14 19 25 26 29 30
31
Sample Output
YES
Problem Source
  qshj

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:6140 today,10426629 total, since 2010-05-07