224. Little Queens
time limit per test: 0.75
memory limit per test: 65536
Well, you might have heard about a curious boy Petya who likes to learn the number of ways one can put k identical chess pieces on a chessboard of size n× n so that no two of them are in the attacking positions. He have solved the problems for bishops, rooks and kings. Recently he has met Farmer John and told him about that.
Impressed FJ has decided to teach his cows to play chess. The first question Bessie asked on the first lesson was: "What about the number of ways one can put k queens on a chessboard of size n × n, so that no two of them are in the attacking positions?"
The queen can move diagonally, horizonatally and vertically, thus combining the properties of a bishop and a rook. Two queens are in the attacking positions if they are on the path of each other.
The input file contains two integers n (1 ≤ n ≤ 10) and k (0 ≤ k ≤ n2).
Print a line containing the total number of ways one can put the given number of queens on a chessboard of the given size so that no two of them are in attacking positions.
|Resource:||Little Chess Pieces Series, SPb IFMO 2003-2004 Authumn Training Sessions
|Server time: 2017-11-21 16:31:56||Online Contester Team © 2002 - 2016. All rights reserved.|