Goldbach's Conjecture

Description

Fangjie is studying evolution of worms. Recently he putforward hypotheses that all worms evolve by division. There are n forms of worms. Worms of these forms have lengths a1, a2, ..., an. To prove his theory, professor needs to find 3 differentforms that the length of the first form is equal to sum of lengths of the othertwo forms. Help him to do this.


Input Description
There are multiple cases ended by EOF , The first line contains integer n (3 ≤ n ≤ 2000) — amount of worm´s forms. The second line contains n space-separated integers ai (1 ≤ ai ≤ 1000) — lengths of worms of each form.
Output Description
Each testcase if exits 3 distinct integers i j k (1 ≤ i, j, k ≤ n) — such indexes of worm´s forms that ai = aj + ak.output”Yes”, otherwise output”No”.
Sample Input
5
1 2 3 5 7
5
1 5 1 8 1
Sample Output
Yes
No
补选赛时做的。
典型的素数打表题。用个数组来存1000内素数。循环即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值