Factorial
Time limit1sMemory limit512 MB
Output a single integer N between 7 and 10^14 that maximizes a score based on how close N! times a power of ten lands to an integer, avoiding floating-point traps.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Brute force, Implementation
- Solved
- No attempts yet
Problem
You have probably seen the following problem before.
Items (2) and (3) are easy, so we focus especially on (1).
At first glance it seems that summing logarithms carefully will do the job, but if you simply write the code that way, floating-point error is a concern.
Kipa is setting this problem, and intends to include as test cases the situations where floating-point error is likely to occur when solving (1).
Help Kipa.
Input
There is no input.
Output
Output one positive integer. The integer you output must be at least 7 and at most 100000000000000.
Constraints
(The source states no constraints.)
Scoring
Let the number you output be , and define the following real number .
For the value fixed in advance by the judges, the real number related to your score is as follows.
If , you receive 998244353 points. Otherwise, the difference between your score and is guaranteed to be at most .
Your score is always an integer multiple of .