BestCoder Round #61 (div.2) HDU5522 Numbers
2015-11-01 00:07
239 查看
Numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/262144 K (Java/Others)Total Submission(s): 95 Accepted Submission(s): 72
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
Source
BestCoder Round #61 (div.2)
出题人:先排序然后从大到小枚举i,把右边的数用一个数组标记其出现过,
再枚举左边的数判断其加上Ai是否出现过.
相关文章推荐
- QP之QEP原理
- cf591A Wizards' Duel
- C++(也许算是吧)+Linux 简易web服务器实现(with EPOLL&THREAD POLL)(1)
- NSString属性什么时候用copy,什么时候用strong?
- 格雷码与二进制码之间的转换
- c++数据生成器
- 个人软件过程5 git命令行方式超简洁教程
- 内存池介绍与经典内存池的实现
- 新人一枚,从此入驻CSDN博客
- 内存池介绍与经典内存池的实现
- opencv中三种像素访问方式的运行速度比较
- crazyflie2.0_crazyflie-firmware_LED指示灯
- ARINC429数据总线简介
- Trie字符串(Remember the Word, LA 3942)
- Eclipse上安装GIT插件EGit
- HDU_5523Game
- 硬盘分区 5
- HDU_5523Game
- 使用浏览器做编辑器
- 不喜欢 IDE?试试看 grepgitvi