#P1014. [NOIP 1999 普及组] Cantor 表

[NOIP 1999 普及组] Cantor 表

Description

One of the famous proofs in modern mathematics is Georg Cantor's proof that the rational numbers are countable. He used the following table to prove this statement:

We number each entry of the table in a Z-shaped order. The first entry is 1/11/1, then 1/21/2, 2/12/1, 3/13/1, 2/22/2, …

Input Format

An integer NN (1N1071 \leq N \leq 10^7).

Output Format

The NN-th term in the table.

7

1/4

Hint

  • 2024-11-18 00:30 Samples were added to the testdata and placed in the non-scoring Subtask 2.

Translated by ChatGPT 5