Submit solution

Points:
10

Time limit:
0.6s

Memory limit:
1G

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

##### ICPC North America Qualifier 2016, Problem G

A factorial of a positive integer is defined as the product of all positive integers smaller than or equal to . For example,

It is straightforward to calculate the factorial of a small integer, and you have probably done it many times before. In this problem, however, your task is reversed. You are given the value of and you have to find the value of .

#### Input Specification

The input contains the factorial of a positive integer . The number of digits of is at most .

#### Output Specification

Output the value of .

#### Sample Input 1

`120`

#### Sample Output 1

`5`

#### Sample Input 2

`51090942171709440000`

#### Sample Output 2

`21`

#### Sample Input 3

`10888869450418352160768000000`

#### Sample Output 3

`27`

## Comments

The time control is quite tight.

You have not implemented the correct solution to this problem. Both Java's and Python's support for large integers still doesn't allow for direct brute-forcing to get the answer. Try thinking of a different approach.