这个关于数字搜索和输出的算法,用c语言怎么实现会比较效率高

Problem Description
There are n numbers A1,A2....An,your task is to check whether there exists there different positive integers i, j, k (1≤i,j,k≤n) such that Ai−Aj=Ak

Input
There are multiple test cases, no more than 1000 cases.
First line of each case contains a single integer n.(3≤n≤100).
Next line contains n integers A1,A2....An.(0≤Ai≤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

https://blog.csdn.net/ESESZB/article/details/52004669

数字搜索的话,数位dp吧