andy6804tw
7/17/2016 - 2:40 PM

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2474 困難度 ★ 三角形的構成條件: 1.任兩邊相加大於第三邊 2.沒有零邊 另外這

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2474 困難度 ★ 三角形的構成條件: 1.任兩邊相加大於第三邊 2.沒有零邊 另外這題大於2的32次方所以形態要使用long

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		for (int i = 0; i < n; i++) {
			long x = scn.nextLong(), y = scn.nextLong(), z = scn.nextLong();
			System.out.printf("Case %d: ", i + 1);
			if ((x + y) <= z || (x + z) <= y || (y + z) <= x||x==0||y==0||z==0) {
				System.out.println("Invalid");
				continue;
			}
			if (x == y && y == z)
				System.out.println("Equilateral");
			else if (x == y || y == z || x == z)
				System.out.println("Isosceles");
			else
				System.out.println("Scalene");
		}
	}
		/* 
    題目:Q11479:  Is this the easiest problem?
    作者:1010
    時間:西元 2016 年 7 月 */
}