fork 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.  
  13.  
  14. int a[]= new int[6];
  15. int m[][]={{1,2,100}, {2,5,100},{3,4,100}};
  16.  
  17. for(int i=0; i<m.length;i++){
  18. int arr[]=m[i];
  19. for(int k=arr[0]; k<=arr[1]; k++)
  20. a[k]+=arr[2];
  21.  
  22. }
  23. int max=0;
  24. for(int j=0; j<a.length;j++){
  25. if(max<a[j])
  26. max=a[j];
  27.  
  28. }
  29. System.out.println(max);
  30. }
  31. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
200