Roots Intervals#2563

Roots Intervals

1 second
64 megabytes
Easy

Consider the function f(x) = \tan(\sin(x)) - \sin(\tan(x)) + \cos^5(x) - 0.5 defined on the interval . Suppose nb \geq 1. Partition the interval into subintervals [x_i, x_{i+1}], where i = 1, \ldots, nb, x_1 = a, and x_{nb+1} = b.

Find the number of subintervals that contain "observable" roots of . A root in a subinterval [x_i, x_{i+1}] is "observable" if the existence of that root can be detected without investigating the behavior of for x_i < x < x_{i+1}; that is, the subinterval is considered a black box and you cannot perform calculations inside the interval.

Input

Each line is a separate test case and contains information about the interval for the function : the endpoints (real numbers), and the integer — the number of subintervals.

The input ends with the end of the file. The sample input and output are given for the function f(x) = 1 - x^2.

Output

For each test case, output the number of subintervals containing "observable" roots of in a separate line.

Examples

Example 1

Loading
Loading