Advertisement
Guest User

A.java

a guest
Mar 30th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3. public class A {
  4.  
  5.     public static void main(String[] args) throws NumberFormatException, IOException {
  6.         Scanner sc = new Scanner(System.in);
  7.         //Scanner sc = new Scanner(new File("A.in"));
  8.         int ncase = sc.nextInt();
  9.         for (int cs = 1; cs <= ncase; cs++) {
  10.             long x1 = sc.nextLong(), y1 = sc.nextLong(), z1 = sc.nextLong();
  11.             long x2 = sc.nextLong(), y2 = sc.nextLong(), z2 = sc.nextLong();
  12.             long x3 = sc.nextLong(), y3 = sc.nextLong(), z3 = sc.nextLong();
  13.             long dx12 = x1 - x2, dy12 = y1 - y2, dz12 = z1 - z2;
  14.             long dx23 = x2 - x3, dy23 = y2 - y3, dz23 = z2 - z3;
  15.             long dx31 = x3 - x1, dy31 = y3 - y1, dz31 = z3 - z1;
  16.             long l12 = dx12*dx12 + dy12*dy12 + dz12*dz12;
  17.             long l23 = dx23*dx23 + dy23*dy23 + dz23*dz23;
  18.             long l31 = dx31*dx31 + dy31*dy31 + dz31*dz31;
  19.             if (l12 + l23 == l31 || l23 + l31 == l12 || l31 + l12 == l23) {
  20.                 System.out.println("right-angled");
  21.             } else if (l12 == l23 && l23 == l31) {
  22.                 System.out.println("equilateral");
  23.             } else {
  24.                 System.out.println("neither");
  25.             }
  26.         }
  27.         sc.close();
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement