问题3452--Roots Intervals

3452: Roots Intervals

[命题人 : ]
时间限制 : 3.000 sec  内存限制 : 64 MB

题目描述

Consider the function f(x)=tan(sin(x))-sin(tan(x))+cos(x)^5-0.5 defined on the interval [a,b], and nb≥1 a series of subintervals [xi,xi+1], i=1,nb, where x1=a and xnb+1=b. Find the number of subintervals that contain “observable” roots of f(x). A root in a subinterval [xi,xi+1] is “observable” if the existence of that root can be decided without inspecting the behavior of f(x) for xixxi+1, i.e. a subinterval is a black box and you cannot compute inside the interval.

输入

The program input is from a text file. Each data set in the file stands for a particular interval [a,b] of f(x) and specifies the limits a, b (real numbers) and the integer number nb of subintervals.

输出

For each data set the program prints the number of subintervals that contain “observable” roots of f(x). Each result is printed on the standard output from the beginning of a line.

样例输入 Copy

-2 2 2
0 100 5
-1 1 1

样例输出 Copy

2
1
1

提示

White spaces can occur freely in the input. The input data are correct and terminate with an end of file. An input/output sample for the function f(x)=1-x^2 is in the table bellow.

来源/分类