Numbers

Time Limit: 1000ms
Memory Limit: 262144KB
This problem will be judged on HDU. Original ID: 5522
64-bit integer IO format: %I64d      Java class name: Main

Description

There are n numbers ${A}_{1},{A}_{2}....{A}_{n}$,your task is to check whether there exists there different positive integers i, j, k ($1\leq i , j , k \leq n$) such that ${A}_{i}-{A}_{j}={A}_{k}$

Input

There are multiple test cases, no more than 1000 cases.
First line of each case contains a single integer n.$(3\leq n\leq 100)$.
Next line contains n integers ${A}_{1},{A}_{2}....{A}_{n}$.$(0\leq {A}_{i}\leq 1000)$

Output

For each case output "YES" in a single line if you find such i, j, k, otherwise output "NO".

Sample Input

3
3 1 2
3
1 0 2
4
1 1 0 2

Sample Output

YES
NO
YES

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .