while (in.hasNext()){ String line = in.nextLine(); String[] part = line.split(" "); BigInteger a = new BigInteger(part[0]); BigInteger b = new BigInteger(part[1]); BigInteger c = new BigInteger(part[2]); // BigInteger max = a > b ?(a > c ? a : c) : (b > c ? b : c); //找最大数 BigInteger max = (a.compareTo(b) > 0) ? (a.compareTo(c) > 0 ? a : c) : (b.compareTo(c) > 0 ? b : c); //最小2边和 BigInteger sum = max.equals(a) ? b.add(c) : (max.equals(b) ? a.add(c) : a.add(b)); //判断:sum>max String result = (sum.compareTo(max)>0)? "Yes" : "No"; System.out.println(result); } } } }
import java.math.BigInteger;
import java.util.Scanner;
public class Demo64 {
public static void main(String[] args) {
try(Scanner input = new Scanner(System.in)){
BigInteger a = null;
BigInteger b = null;
BigInteger c = null;
while (input.hasNextBigInteger()){
a = input.nextBigInteger();
b = input.nextBigInteger();
c = input.nextBigInteger();
BigInteger max = a.max(b.max(c));
BigInteger min = a.min(b.min(c));
BigInteger mid = a.add(b.add(c)).subtract(max).subtract(min);
String result = (max.compareTo(min.add(mid)) < 0) ? "Yes" : "No";
System.out.println(result);
}
}
}
} import java.util.*;
import java.math.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
BigDecimal a = sc.nextBigDecimal();
BigDecimal b = sc.nextBigDecimal();
BigDecimal c = sc.nextBigDecimal();
if(a.add(b).compareTo(c) > 0
&& a.add(c).compareTo(b) > 0
&&c.add(b).compareTo(a) > 0){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
} //最小值+中间值>最大值即成立 可自行证明
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Test9 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext())
{
String str = sc.nextLine();
String[] ss = str.split(" ");
BigInteger a = new BigInteger(ss[0]);
BigInteger b = new BigInteger(ss[1]);
BigInteger c = new BigInteger(ss[2]);
//找出a b c 三边最大边,最小,和中间值
//如果max<middle+min,就可以构成三角形
BigInteger max=null;
BigInteger mid=null;
BigInteger min=null;
List<BigInteger> list = new ArrayList();
list.add(a);
list.add(b);
list.add(c);
list.sort(null);
//成立条件
if(list.get(0).add(list.get(1)).compareTo(list.get(2))>0)
{
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
}