No tags yet

No tag edit access

time limit per test: 0.75 sec.

memory limit per test: 65536 KB

memory limit per test: 65536 KB

input: standard

output: standard

output: standard

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.

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 ≤ n

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.

Input

Test #1

3 2

Test #2

4 4

3 2

Test #2

4 4

Output

Test #1

8

Test #2

2

8

Test #2

2

Author: | Andrew Stankevich |

Resource: | Little Chess Pieces Series, SPb IFMO 2003-2004 Authumn Training Sessions |

Date: | 2003-10-08 |

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/18/2019 22:51:23 (e1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|