|VIRTUAL JUDGE||Recent Contest||F.A.Qs||Forum||Home||ProblemSet||Status||Ranklist||Contest||Login||Register||Exam|
Little Bishops A bishop is a piece used in the game of chess which can only move diagonally from its current position. Two bishops attack each other if one is on the path of the other. In the figure below, the dark squares represent the reachable locations for bishop B1 from its current position. Bishops B1 and B2 are in attacking position, while B1 and B3 are not. Bishops B2 and B3 are also in non-attacking position. Given two numbers n and k, determine the number of ways one can put k bishops on an n x n chessboard so that no two of them are in attacking positions.
The input file may contain multiple test cases. Each test case occupies a single line in the input file and contains two integers n(1 <= n <= 8) and k(0 <= k<=n2). A test case containing two zeros terminates the input
For each test case, print a line containing the total number of ways one can put the given number of bishops on a chessboard of the given size so that no two of them lie in attacking positions. You may safely assume that this number will be less than 1015.
8 6 4 4 0 0
한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin