fork download
  1. import java.util.*;
  2. public class Main{
  3. public static void main(String[]args){
  4. Scanner sc=new Scanner (System.in);
  5. int t=sc.nextInt();
  6. double x,s,h,ta,trapa;
  7. if(t<=20){
  8. for(int i=1;i<=t;i++){
  9. double a=sc.nextDouble();
  10. double b=sc.nextDouble();
  11. double c=sc.nextDouble();
  12. double d=sc.nextDouble();
  13. x=Math.abs(a-c);
  14. s=0.5*(x+b+d);
  15. ta=Math.sqrt((s*(s-x)*(s-b)*(s-d)));
  16. h=(ta*2)/x;
  17. trapa=0.5*(a+c)*h;
  18. if(trapa>=0 && trapa<=200){
  19. System.out.printf("%.4f%n Case"+i+": "+trapa);
  20. }
  21. }
  22. }
  23. }
  24. }
Runtime error #stdin #stdout #stderr 0.08s 4386816KB
stdin
2
6 5 12 5.0
9 5 6 4
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%.4f'
	at java.util.Formatter.format(Formatter.java:2519)
	at java.io.PrintStream.format(PrintStream.java:970)
	at java.io.PrintStream.printf(PrintStream.java:871)
	at Main.main(Main.java:19)