Say No To Drugs solution codechef- There are NN people participating in a race. The NthNth participant is your friend, so you want him to win. You are not a man of ethics, so you decided to inject some units of a Performance Enhancement Drug (don’t ask where that came from) in your friend’s body.
September 2, 2021
The Old Saint And Three Questions codechef solution- Once upon a time, there was a hero and an old saint. And like in any story with a hero and an old saint, the old saint asked the hero — three questions!
September 2, 2021
August 26, 2021
Infinity Table solution codeforces
Polycarp has found a table having an infinite number of rows and columns. The rows are numbered from, starting from the topmost one. The columns are numbered from , starting from the leftmost one.
Initially, the table hasn’t been filled and Polycarp wants to fix it. He writes integers fromand so on to the table as follows.
First, Polycarp selects the leftmost non-filled cell in the first row and fills it. Then, while the left neighbor of the last filled cell is filled, he goes down and fills the next cell. So he goes down until the last filled cell has a non-filled neighbor to the left (look at the vertical arrow going down in the figure above). Infinity Table solution codeforces
After that, he fills the cells from the right to the left until he stops at the first column (look at the horizontal row in the figure above). Then Polycarp selects the leftmost non-filled cell in the first row, goes down, and so on.
A friend of Polycarp has a favorite number. He wants to know which cell will contain the number. Help him to find the indices of the row and the column, such that the intersection of the row and the column is the cell containing the number .
The first line contains one integer( ) — the number of test cases. Then test cases follow.
Each test case consists of one line containing one integer( ) which location must be found.
For each test case, output in a separate line two integersand ( ) separated by spaces — the indices of the row and the column containing the cell filled by the number , respectively.
7 11 14 5 4 1 2 1000000000
2 4 4 3 1 3 2 1 1 1 1 2 31623 14130