luogu#P11310. 「WPOI-R2」无穷的迭代器

    ID: 9071 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>数学数论洛谷原创O2优化洛谷月赛

「WPOI-R2」无穷的迭代器

Problem Description

For a real number r r , defining an operation as:

  • rrr r \leftarrow r\lceil r \rceil r \lceil r \rceil is smallest integer that is not less than r).

Give a nonnegative integer k k ,what is the minimum number of operations that need to be performed on r=k+0.5 r=k+0.5 to make r r an integer?

Input Format

This is a multiple test problem, where the first line an integer T T represents the number of data sets.

For each group of data: One integer k k in the first line, the meaning of which is described in the description section.

Output Format

If it can be made into an integer, output one line with an integer representing the smallest number of times you found it.

If it cannot be made into an integer, output a line NO!.

1
4
3
1
0
NO!

Hint

「Sample 1 Explanation」

Times r r
0 0 92 \frac{9}{2}
1 1 452 \frac{45}{2}
2 2 10352 \frac{1035}{2}
3 3 268065 268065

「Data sizes and conventions」

This question is scored as a bundle.

For 100% of data, 1T20 1 \le T \le 20 0k1018 0 \le k \le 10^{18} .

  • Subtask 1(15 pts):1k10 1 \le k \le 10
  • Subtask 2(40 pts):1k100 1 \le k \le 100
  • Subtask 3(45 pts):0k1018 0 \le k \le 10^{18}