fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.Scanner;
  5.  
  6. class Main
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. int n, e, k=0, m, maxk = 0, maxn = 1000000000, p = 1;
  11. Scanner in = new Scanner(System.in);
  12. e = in.nextInt();
  13. while (e -- > 0) {
  14. n = in.nextInt();
  15. if (p <= n){
  16. m = n;
  17. k = 0;
  18. while ((n % 10) == 0) {
  19. //считает нули
  20. n = n / 10;
  21. k ++;
  22. }
  23. if (maxk < k) {
  24. maxn = m;
  25. maxk = k;
  26. p = 1;
  27. for (int i = 1; i < maxk; i ++) {
  28. p *= 10;
  29. }
  30. } else if (maxk == k) {
  31. if(maxn > m) maxn = m;
  32. }
  33. }
  34. }
  35. System.out.print(maxn);
  36. }
  37. }
Success #stdin #stdout 0.06s 2184192KB
stdin
4
100000
200000
500000
800000
stdout
100000