fork(15) download
  1. public class MutaliskEasy {
  2.  
  3.  
  4. int[][][] dpMem;
  5.  
  6. int dp(int a, int b, int c)
  7. {
  8. if(a < 0) a = 0;
  9. if(b < 0) b = 0;
  10. if(c < 0) c = 0;
  11. if(a+b+c == 0) return 0;
  12. if(dpMem[a][b][c] >= 0) return dpMem[a][b][c];
  13. int ret = 10000;
  14. ret = Math.min(ret, 1 + dp(a - 9, b - 3, c - 1));
  15. ret = Math.min(ret, 1 + dp(a - 9, b - 1, c - 3));
  16. ret = Math.min(ret, 1 + dp(a - 3, b - 1, c - 9));
  17. ret = Math.min(ret, 1 + dp(a - 3, b - 9, c - 1));
  18. ret = Math.min(ret, 1 + dp(a - 1, b - 3, c - 9));
  19. ret = Math.min(ret, 1 + dp(a - 1, b - 9, c - 3));
  20. dpMem[a][b][c] = ret;
  21. return ret;
  22. }
  23.  
  24. public int minimalAttacks(int[] x)
  25. {
  26. dpMem = new int[61][61][61];
  27. for(int i = 0; i <= 60; i++)
  28. for(int j = 0; j <= 60; j++)
  29. for(int k = 0; k <= 60; k++)
  30. dpMem[i][j][k] = -1;
  31. return dp((x.length > 0 ? x[0] : 0), (x.length > 1 ? x[1] : 0), (x.length > 2 ? x[2] : 0));
  32. }
  33.  
  34. }
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class MutaliskEasy is public, should be declared in a file named MutaliskEasy.java
public class MutaliskEasy {
       ^
1 error
stdout
Standard output is empty