fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.math.*;
  5. import java.text.*;
  6.  
  7. class Triangles
  8. {
  9. public static double square(double num){ return num*num; }
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner in = new Scanner(System.in);
  13. double s[] = new double[3];
  14. for(int i = 0; i < 3; i++)
  15. s[i] = in.nextDouble();
  16. java.util.Arrays.sort(s);
  17. if(s[0] + s[1] <= s[2]){
  18. System.out.println("The triangle doesn't exist.");
  19. }
  20. else{
  21. double cosValue = Math.cos((square(s[0]) + square(s[1]) + square(s[2]))/(2*s[0]*s[1]));
  22. if(cosValue > 0) System.out.println("The triangle is acute.");
  23. else System.out.println("The triangle is not acute.");
  24. }
  25. }
  26. }
Runtime error #stdin #stdout #stderr 0.14s 321280KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.NoSuchElementException
	at java.util.Scanner.throwFor(Scanner.java:862)
	at java.util.Scanner.next(Scanner.java:1485)
	at java.util.Scanner.nextDouble(Scanner.java:2413)
	at Triangles.main(Main.java:15)