hdoj 2039 三角形
2015-08-23 09:39
260 查看
三角形
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 59305 Accepted Submission(s): 20085
Problem Description
给定三条边,请你判断一下能不能组成一个三角形。
Input
输入数据第一行包含一个数M,接下有M行,每行一个实例,包含三个正数A,B,C。其中A,B,C <1000;
Output
对于每个测试实例,如果三条边长A,B,C能组成三角形的话,输出YES,否则NO。
Sample Input
2 1 2 3 2 2 2
Sample Output
NO YES#include<stdio.h> int main() { int n; double a,b,c; scanf("%d",&n); while(n--) { scanf("%lf%lf%lf",&a,&b,&c); if((a+b>c)&&(b+c>a)&&(a+c>b)) printf("YES\n"); else printf("NO\n"); } }自己写的一个:
三角形判断: #include<stdio.h> #include<math.h> int main() { int a,b,c; printf("please input three side "); scanf("%d%d%d",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { if(a==b&&b==c&&a==c) printf("等边三角形"); else if(a==b||b==c||a==c) printf("等腰三角形"); else if(a*a+b*b==c*c||a*a+c*c==b*b||a*a+c*c==b*b) printf("直角三角形"); else printf("普通三角形") ; } else printf("bushi "); }
相关文章推荐
- 联合国会员国列表 193个
- Android 使用开源库加载网络图片
- [NOIP2007]统计数字
- UVA 11859 - Division Game(Nim游戏)
- Deep learning:二十(无监督特征学习中关于单层网络的分析)
- Bad Hair Day(问题抽象转化+“贡献值”思想+单调栈)
- Intellij IDEA工具Java web 环境搭建
- win7下jdk环境变量的配置
- 操作系统 - 经典的线程模型
- Deep learning:十九(RBM简单理解)
- Deep learning:十八(关于随机采样)
- ssoj2385path
- 操作系统 - 经典的线程模型
- 如何解决WampServer #1405 - Access denied for user 'root'@'localhost' (using password: NO)
- CodeForces 572A-Arrays
- Opencv的moveWindow函数
- Deep learning:十七(Linear Decoders,Convolution和Pooling)
- Deep learning:十六(deep networks)
- 第三方框架 - 03.SDWebImage框架
- Deep learning:十五(Self-Taught Learning练习)