Queen
Easy
Execution time limit is 1 second
Runtime memory usage limit is 122.599 megabytes
Compute how many squares on average does a queen attack on a generalized chess board n × n.
The queen attacks a square if it is on the same row, column or diagonal. For example, the queen denoted by the letter Q in the image bellow attacks 17 squares marked with dots:
Input
The first line contains positive integer n (1 ≤ n ≤ 10^6
), the number of lines and columns of a board.
Output
The output consists of one real number rounded to exactly three decimal places, the average number of fields attacked by a queen.
Examples
Input #1
Answer #1
Submissions 492
Acceptance rate 24%