fork download
  1. public class FoxAndSouvenirTheNext
  2. {
  3.  
  4. public String ableToSplit(int[] value)
  5. {
  6. boolean[][] ableToGet = new boolean[51][2501];
  7. for(int i = 0; i < value.length; i++)
  8. for(int j = 0; j <= 2500; j++)
  9. ableToGet[i][j] = false;
  10. ableToGet[0][0] = true;
  11. int sum = 0;
  12. for(int i = 0; i < value.length; i++)
  13. {
  14. sum += value[i];
  15. for(int j = i; j >= 1; j--)
  16. for(int k = 2500; k >= value[i]; k--)
  17. ableToGet[j][k] |= ableToGet[j-1][k - value[i]];
  18. }
  19. if(value.length % 2 == 0 && sum % 2 == 0 && ableToGet[value.length / 2][sum / 2] == true)
  20. return "Possible";
  21. return "Impossible";
  22. }
  23.  
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class FoxAndSouvenirTheNext is public, should be declared in a file named FoxAndSouvenirTheNext.java
public class FoxAndSouvenirTheNext
       ^
1 error
stdout
Standard output is empty