fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println(function(1,2,3));
  13. System.out.println(function(1,3,2));
  14. System.out.println(function(2,1,3));
  15. System.out.println(function(2,3,1));
  16. System.out.println(function(3,1,2));
  17. System.out.println(function(3,2,1));
  18. }
  19.  
  20. private static boolean function(int a,int b,int c)
  21. {
  22. return prefunction(a,b,c) == postfunction(a,b,c);
  23. }
  24.  
  25. private static int prefunction(int a,int b,int c)
  26. {
  27. return Math.min(Math.min(a,b+2),c+2);
  28. }
  29.  
  30. private static int postfunction(int a,int b,int c)
  31. {
  32. return Math.min(a,Math.min(b,c+2)+2);
  33. }
  34. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
true
true
true
true
true
true