2460 - 判断三角形
已知三条线段的长度,判断三条线段是否能组成三角形。
Input
从键盘输入三个整数,中间用空格隔开。
Output
如果这三条线段能够组成三角形则输出“yes”,否则输出“no”。
Examples
Input
12 17 24
Output
yes
Solution C++
#include<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a+b>c and a+c>b and c+b>a) { printf("yes"); } if(a+b<=c or a+c<=b or c+b<=a) { printf("no"); } }