P10314 [SHUPC 2024] Function

Description

Little A is learning about functions. One day, she found a wonderful function: $$ f(x)=x-0.5+\frac{\arctan(\cot(\pi x))}{\pi} $$ She likes this function very much. Now, she will ask you $T$ queries. Each query contains a floating-point number $x$, and you only need to output the value of $f(x)$. An output is considered correct if the absolute error or relative error compared with the standard answer does not exceed $10^{-6}$.

Input Format

The first line contains an integer $T\ (T\le 10^4)$, indicating the number of test cases. In the next $T$ lines, each line contains a floating-point number $x$. It is guaranteed that $0 \le x \le 10^9$ and $x \notin \N$ (i.e., $x$ is not a natural number).

Output Format

Output $T$ lines, each containing one number, which is the answer. An output is considered correct if the absolute error or relative error compared with the standard answer does not exceed $10^{-6}$.

Explanation/Hint

Translated by ChatGPT 5