Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language: C++ (Need to use backtracking!) Given a board with irregular shape, your task is to place chess pieces and make sure no more than
Language: C++ (Need to use backtracking!)
Given a board with irregular shape, your task is to place chess pieces and make sure no more than 1 chess pieces is placed on the same row or the same column. Output the number of different ways of such placement.
The first line of the input consists of two integers n and k. n means the size of board is nn and k is the number of chess pieces to be placed. The next n lines describe the shape of the chess board: '#' describes the board region and '.' is the blank region (cannot place chess piece here).
Example 1 Input: 2 1 .# #. Output: 2 Example 2 Input: 33 #. # ## Output: 2 Example 3 Input: 4 4 # Output: 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started