223. Little Kings
time limit per test: 0.5
sec.
memory limit per test: 65536
KB
input: standard
output: standard
After solving nice problems about bishops and rooks, Petya decided that he would like to learn to play chess. He started to learn the rules and found out that the most important piece in the game is the king.
The king can move to any adjacent cell (there are up to eight such cells). Thus, two kings are in the attacking position, if they are located on the adjacent cells.
Of course, the first thing Petya wants to know is the number of ways one can position k kings on a chessboard of size n × n so that no two of them are in the attacking position. Help him!
Input
The input file contains two integers n (1 ≤ n ≤ 10) and k (0 ≤ k ≤ n^{2}).
Output
Print a line containing the total number of ways one can put the given number of kings on a chessboard of the given size so that no two of them are in attacking positions.
Sample test(s)
Input
Test #1
3 2
Test #2
4 4
Output
Test #1
16
Test #2
79
Author:  Andrew Stankevich

Resource:  Little Chess Pieces Series, SPb IFMO 20032004 Authumn Training Sessions

Date:  20031004

Server time: 20180219 01:06:35  Online Contester Team © 2002  2016. All rights reserved. 

