fork download
  1. import java.io.BufferedReader;
  2. import java.io.BufferedWriter;
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileReader;
  6. import java.io.InputStreamReader;
  7. import java.io.OutputStreamWriter;
  8. import java.io.PrintWriter;
  9. import java.util.StringTokenizer;
  10.  
  11.  
  12.  
  13.  
  14. public class Main {
  15. static StringBuffer sb;
  16. static int[][] killed;
  17. static int N;
  18. static int d;
  19. static int tests;
  20.  
  21. public static void main(String[]args) throws Throwable{
  22. tests = Integer.parseInt(br.readLine());
  23. sb = new StringBuffer();
  24.  
  25. for(int i=0;i<tests;i++){
  26. d = Integer.parseInt(br.readLine());
  27. N = Integer.parseInt(br.readLine());
  28. killed = new int[1025][1025];
  29.  
  30. for(int j=0;j<N;j++){
  31. st = new StringTokenizer(br.readLine());
  32. int x = Integer.parseInt(st.nextToken());
  33. int y = Integer.parseInt(st.nextToken());
  34. int c = Integer.parseInt(st.nextToken());
  35. for(int f = x-d;f<=x+d;f++){
  36. for(int k=y-d;j<=k+d;k++){
  37. if(f>=0&&k>=0&&k<1025&&f<1025) killed[f][k] = killed[f][k] +c;
  38. }
  39.  
  40. }
  41. }
  42.  
  43.  
  44. int max = -1;
  45. int xc = -1;
  46. int yc = -1;
  47. for(int x=0;x<1025;x++){
  48. for(int y=0;y<1025;y++){
  49. if(killed[x][y]>max){
  50. xc = x;
  51. yc = y;
  52. max = killed[x][y];
  53. }
  54. }
  55. }
  56. sb.append(xc+" "+yc+" "+max+"\n");
  57. }
  58. System.out.print(sb);
  59.  
  60.  
  61. }
  62. }
Runtime error #stdin #stdout #stderr 0.07s 380160KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:454)
	at java.lang.Integer.parseInt(Integer.java:527)
	at Main.main(Main.java:23)