fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String args[]) {
  5. Scanner in = new Scanner(System.in);
  6. int n = in.nextInt(),div=5;
  7. while (n-- >= 0) {
  8. int fact=in.nextInt(),count=0;
  9. while(fact>=div){
  10. count+=fact/div;
  11. div=div*5;
  12. }
  13. System.out.println(count);
  14. }
  15. in.close();
  16. }
  17. }
Runtime error #stdin #stdout #stderr 0.09s 380672KB
stdin
7
5
3
60
100
1024
23456
8735373
stdout
1
0
2
0
9
8
137
stderr
Exception in thread "main" java.util.NoSuchElementException
	at java.util.Scanner.throwFor(Scanner.java:907)
	at java.util.Scanner.next(Scanner.java:1530)
	at java.util.Scanner.nextInt(Scanner.java:2160)
	at java.util.Scanner.nextInt(Scanner.java:2119)
	at Main.main(Main.java:8)