fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception{
  9. // your code goes here
  10. Scanner in = new Scanner(System.in);
  11. int m = in.nextInt();
  12. int n = in.nextInt();
  13. boolean meven = m % 2 == 0 ? true : false;
  14. boolean neven = n % 2 == 0 ? true : false;
  15. double x;
  16.  
  17. if (meven && neven)
  18. {
  19. x = m*n/4;
  20. }
  21. else if (meven && !neven)
  22. {
  23. x = m*(n-1) / 4;
  24. }
  25. else if (!meven && neven)
  26. {
  27. x = n*(m-1) / 4;
  28. }
  29. else
  30. {
  31. if (n>m)
  32. {
  33. int tmp=n;
  34. n = m;
  35. m = tmp;
  36. }
  37. if ((n-1)%4 == 0)
  38. {
  39. x = m*(n-1) / 4;
  40. }
  41. else
  42. {
  43. x = (m*(n-1)-2)/4;
  44. }
  45. }
  46. System.out.println(x);
  47. }
  48. }
Runtime error #stdin #stdout #stderr 0.08s 29168KB
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.nextInt(Scanner.java:2117)
	at java.util.Scanner.nextInt(Scanner.java:2076)
	at Ideone.main(Main.java:11)