CSES - Chessboard and Queens
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Your task is to place eight queens on a chessboard so that no two queens are attacking each other. As an additional challenge, each square is either free or reserved, and you can only place queens on the free squares. However, the reserved squares do not prevent queens from attacking each other.
How many possible ways are there to place the queens?
Input
- The input has eight lines, and each of them has eight characters. Each square is either free (
.) or reserved (*).
Output
- Print one integer: the number of ways you can place the queens.
Example Input
........
........
..*.....
........
........
.....**.
...*....
........
Example Output
65
Bình luận