sqrt log sin
Time limit1sMemory limit128 MB
Precompute x_i for all i up to 10^6 using the given recurrence with floating point floors, then answer each query modulo 10^6.
- Level
Medium4 of 10
- Topics
- Dynamic programming, Math, Implementation, Prefix sum
- Solved
- No attempts yet
Problem
Dohyun is doing his math homework. The assignment reads as follows.
Consider the sequence defined recursively by
Compute the value of .
More generally, write a program that, given an integer , computes . Here is the floor of (the greatest integer not exceeding ), is the natural logarithm, and the argument of is measured in radians.
Input
The input consists of several test cases, one integer per line, where .
The last line contains , which marks the end of the input and must not be processed.
Output
For each given , print modulo on its own line.