fork download
  1. class Ideone {
  2. public static void main(String[] args) {
  3. int[] data = { 10, 8,
  4. 1, 1, 4, 2,
  5. 2, 4, 6, 4,
  6. 4, 2, 5, 0,
  7. 4, 3, 4, 5,
  8. 5, 2, 6, 1,
  9. 3, 5, 4, 2,
  10. 6, 4, 6, 5,
  11. 7, 2, 6, 1 };
  12. trees(data);
  13. }
  14. private static int W, H;
  15. public static String[] trees(int[] input)
  16. {
  17. W = input[0];
  18. H = input[1];
  19.  
  20. int x1, x2, y1, y2;
  21.  
  22. for (int i = 2; i < input.length; i+=4)
  23. {
  24. x1 = input[i];
  25. x2 = input[i + 1];
  26. y1 = input[i + 2];
  27. y2 = input[i + 3];
  28.  
  29. System.out.println(x1 + x2 + y1 + y2);
  30. }
  31. return null;
  32. }
  33. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
8
16
11
16
14
14
21
16