hdu 6512 Triangle
After the Xiaoxun knew it, he wanted to give a triangle as a gift to Xiaoteng. He originally planned to do one, but he was too tired. So he decided to bring some wooden sticks to Xiaoteng and let Xiaoteng make a triangle himself.
One day, Xiaoxun brought n sticks to Xiaoteng. Xiaoteng wanted to try to use three of them to form a triangle, but the number is too much, Xiaoteng stunned, so he can only ask for your help.
Each case starts with a line containing a integer n(1≤n≤5×106) which represent the number of sticks and this is followed by n positive intergers(smaller than 231−1) separated by spaces.
1 2 3 4
#include <iostream>
#include <cstdlib>
#include <cstdio> using namespace std;
int n,a[];
int main() {
while(~scanf("%d",&n)) {
for(int i = ;i < && i < n;i ++) {
scanf("%d",&a[i]);
}
int flag = ;
for(int i = ;i < n;i ++) {
scanf("%d",&a[i]);
if(flag) continue;
if(a[i - ] > a[i] - a[i - ]) {
flag = ;
}
}
puts(flag ? "YES" : "NO");
}
}
hdu 6512 Triangle的更多相关文章
- HDU 5914 Triangle 数学找规律
Triangle 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Description Mr. Frog has n sticks, who ...
- hdu 4324 Triangle LOVE
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4324 Triangle LOVE Description Recently, scientists f ...
- HDU 5914 Triangle 【构造】 (2016中国大学生程序设计竞赛(长春))
Triangle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Su ...
- HDU 5914 Triangle(打表——斐波那契数的应用)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5914 Problem Description Mr. Frog has n sticks, whos ...
- HDU 4324 Triangle LOVE 拓扑排序
Problem Description Recently, scientists find that there is love between any of two people. For exam ...
- HDU 4324 Triangle LOVE (拓扑排序)
Triangle LOVE Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Tot ...
- HDU 6300.Triangle Partition-三角形-水题 (2018 Multi-University Training Contest 1 1003)
6300.Triangle Partition 这个题就是输出组成三角形的点的下标. 因为任意三点不共线,所以任意三点就可以组成三角形,直接排个序然后输出就可以了. 讲道理,没看懂官方题解说的啥... ...
- hdu 4324 Triangle LOVE(拓扑判环)
Triangle LOVE Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- hdu 4324 Triangle LOVE(拓扑排序,基础)
题目 /***************************参考自****************************/ http://www.cnblogs.com/newpanderking ...
随机推荐
- 数组可以直接转换为DataRow
string[] cc=new string[3]{...}; Dt.Rows.Add(cc);
- C#一般处理程序 ashx.cs使用Session报错问题
HttpContext.Current.Session["UserID"].ToString();//报错,报Session为Null, 此时需要添加引用和继承IRequiresS ...
- oracle 在xml中批量插入,批量修改及多组条件查询
最近公司用ibatis开发项目,本来可以用存储过程处理批量插入,批量修改及多组条件查询:但由于使用模块相对较小,暂时就在xml中配置,以前没有在xml做过类似处理,有必要记录一下:好了,代码如下: & ...
- [Python Study Notes]行人检测
# -------------------------------------------------------------- # @文件: 行人识别.py # @工程: blog # @时间: 2 ...
- 【转】phpize学习
为什么使用phpize? 比如刚开始安装的时候使用 ./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindi ...
- 使用database control配置数据库时 要求在当前oracle主目录中配置监听程序
1:配置本地的环境变量 打开cmd命令界面 C:\Users\gechong>lsnrctl start 这时候报适配器错误 2.在cmd中输入 tnslsnr命令
- Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复
网上很多写法都是 type='fanout' 这样的.(这里是基于python=3.6版本, pika=0.13.0 版本) credentials = pika.PlainCredentials(' ...
- Socket编程--TCP服务端注意事项
僵尸进程处理 僵尸进程和孤儿进程: 基本概念:我们知道在unix/linux中,正常情况下,子进程是通过父进程创建的,子进程在创建新的进程.子进程的结束和父进程的运行是一个异步过程,即父进程永远无法预 ...
- Linux修改MySQL max_allowed_packet 值
修改配置文件 vi /etc/my.cnf change "max_allowed_packet = 1M" to "max_allowed_packet = 32M&q ...
- jquery('tr','div')和jquery('tr,div')
jQuery('tr', 'div') 等价于 $('tr', 'div') 表示div里面寻找tr jQuery('tr, div') <=> $('tr, div') 表 ...