electicode
Bosh sahifaKurslarResurslarMasalalarMilliy olimpiadaMusobaqalarReyting
...

A puzzle about queens

Vaqt limiti: 1000msXotira limiti: 256MB
Barcha yechimlar

Masala tavsifi

Vasya recently started playing chess and somewhere read a puzzle in which it was necessary to place the maximum number of queens on an 8×88 \times 88×8 board so that at least one square remained unattacked. This problem is easily solved for a 3×33 \times 33×3 board, since it is clear that it is impossible to place more than two queens on it in this way. Help Vasya solve this problem for an N×NN \times NN×N board.

Input Format

The input contains a natural number NNN -- the size of the chessboard N×NN \times NN×N (1≤N≤100)(1 \le N \le 100)(1≤N≤100).

Output Format

In the output, you need to print the maximum number of queens that can be placed on an N×NN \times NN×N chessboard so that one square remains unattacked.

Misollar

Misol 1
Kirish
3
Chiqish
2

© 2026 Electicode. All rights reserved.