ZOJ-1241

来源:互联网 发布:centos7搭建lnmp 知乎 编辑:程序博客网 时间:2024/04/26 10:54
import java.util.Scanner;public class Main{public static void main(String[] args){Scanner sc = new Scanner(System.in);int a = sc.nextInt();int b = sc.nextInt();int c = sc.nextInt();int i = 0;while (!(a == 0 && b == 0 && c == 0)){System.out.println("Triangle #" + ++i);if (a == -1){if (b >= c)System.out.println("Impossible.\n");elseSystem.out.format("a = %.3f\n\n", Math.sqrt(c * c - b * b));}if (b == -1){if (a >= c)System.out.println("Impossible.\n");elseSystem.out.format("b = %.3f\n\n", Math.sqrt(c * c - a * a));}if (c == -1){System.out.format("c = %.3f\n\n", Math.sqrt(b * b + a * a));}a = sc.nextInt();b = sc.nextInt();c = sc.nextInt();}}}

0 0