fork(2) download
  1. import java.util.*;
  2.  
  3. class C_Blinds {
  4. public static void main(String[] args) {
  5. Scanner s = new Scanner(System.in);
  6. int n = s.nextInt(), l = s.nextInt();
  7. int[] a = new int[n];
  8. int max = 0;
  9. for (int i = 0; i < n; ++i) {
  10. int v = s.nextInt();
  11. max = Math.max(max, a[i] = v);
  12. }
  13. int result = 0;
  14. for (;l <= max; ++l) {
  15. int count = 0;
  16. for(int b : a){
  17. count += b / l;
  18. }
  19. result = Math.max(result, l * count);
  20. }
  21. System.out.println(result);
  22. }
  23. }
  24.  
Success #stdin #stdout 0.06s 213888KB
stdin
4 2
1 2 3 4
stdout
8