package zh.codegym.task.task04.task0415;
/*
三角形法则
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//在此编写你的代码
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sa = reader.readLine();
String sb = reader.readLine();
String sc = reader.readLine();
int a = Integer.parseInt(sa);
int b = Integer.parseInt(sb);
int c = Integer.parseInt(sc);
isTriangleExist(a,b,c);
}
public static void isTriangleExist(int a, int b, int c){
triangleExist(a,b,c);
if(triangleExist(a,b,c)){
System.out.println("三角形可能存在。");
} else{
System.out.println("三角形不可能存在。");
}
}
public static Boolean triangleExist(int a, int b, int c){
int d = compare(a,b);
if(d > c){
if(a > b){
if((b+c) > a){
return true;
}
} else {
if((a + c) > b){
return true;
}
}
}else {
if((a + b) > c){
return true;
}
}
return false;
}
public static int compare(int a ,int b){
if(a > b) return a;
else return b;
}
}
三角形
Under discussion
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet