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 ...
随机推荐
- WCF上传大文件处理方法
<system.serviceModel> <bindings> <basicHttpBind> <Binding name=" maxReceiv ...
- 浅谈Android四大组建之一Service---Service的创建
Service是安卓四大组件之一,个人觉得Service的使用还是比较简单的额,可以理解为看不见的Activity,因为Service的使用和Activity十分接近.启动啊,生命周期等,都十分简单. ...
- Hibernate 简易入门教程
Hibernate HIbernate主要包含如下几个接口:Session,Query,Criteria以及Transaction.这些接口的实现在幕后是紧密相连的. 在一个HIbernate应用程序 ...
- 窗体控件JFrame的使用
---------------siwuxie095 工程名:TestUI 包名:com.siwuxie095.ui 类名:MyFrame.java 工程结构目录如下: 在 Source 界面和 Des ...
- ZF 语法
Zend Framework Command Line Console Tool v1.11.11 Details for action "" and provider " ...
- C++重载流插入和流输出运算符
demo: /* Name: 重载输入输出流运算符使力代码 Copyright: qianshou Author: zhaozhe Date: 07/12/13 00:11 Description: ...
- Spring 第一天课程
一. 面试题部分 1. 什么是IOC?什么是DI?他们有什么区别? 答案: IOC,即控制反转.是指将原来程序中自己创建实现类对象的控制权反转到IOC容器中. IOC的别名:依赖注入(DI),DI 是 ...
- Halcon从某一个图片以指定区域绘制到另一个图像
************************************************************* * Halcon从某一个图片以指定区域绘制到另一个图像 * Author: ...
- 算法Sedgewick第四版-第1章基础-015一stack只保留last指针
/************************************************************************* * * A generic queue, impl ...
- NSWindow上添加NSView
DBSCustomView *view = [[DBSCustomView alloc] initWithFrame:NSMakeRect(100, 100, 100, 100)]; [self.wi ...