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. // your code goes here
  13. int[] arr = {2, 4, 5, 6, 1};
  14. int N = arr.length;
  15.  
  16. for(int i = 0; i < N; i++){
  17. int min = Integer.MAX_VALUE;
  18. int sum = 0;
  19. for(int j = i; j <N; j++){
  20. min = Math.min(min, arr[j]);
  21. sum += arr[j];
  22.  
  23. System.out.println(min * sum);
  24. }
  25. }
  26. }
  27. }
Success #stdin #stdout 0.12s 54564KB
stdin
Standard input is empty
stdout
4
12
22
34
18
16
36
60
16
25
55
12
36
7
1