BubbleQueen
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:
Image: queenExample
InputThe first line contains positive integer n (1≤n≤1,000,000), the number of lines and columns of a board.
OutputThe output consists of one real number rounded to exactly three decimal places, the average number of fields attacked by a queen.
Input:
3
Output:
6.222
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.