编程介的小学生 2019-11-22 10:07 采纳率: 20.5%
浏览 80

N Knight 代码编写过程

Problem Description
Today, chess is one of the world's most popular games, played by millions of people worldwide at home, in clubs, online, by correspondence, and in tournaments.

Chess is played on a square board of eight rows and eight columns and denoted with letters a to h of squares. The colors of the sixty-four squares alternate and are referred to as "light squares" and "dark squares". The chessboard is placed with a light square at the right hand end of the rank nearest to each player, and the pieces are set out as shown in the diagram, with each queen on its own color.

The pieces are divided, by convention, into white and black sets. The players are referred to as "White" and "Black", and each begins the game with sixteen pieces of the specified color. These consist of one king, one queen, two rooks, two bishops, two knights and eight pawns.

Now we have another way to play with the chessboard. Give you a N*N chessboard, and ask you to place N knights on it. But the knights can’t attack each other (one knight can attack other chessman in the same row or in the column). And what’s more, no more than M knights are permissible to put on the reverse diagonal (the black grids as following picture). Now ask you how many different ways you can place this N Knight.

Input
Input contains multiple cases each presented on a separate line. Each line contains two integer numbers N,M(1<=N<=1000,0<=M<=N).

Output
For each test case, your program should output the answer mod 20090818.

Sample Input
1 1

Sample Output
1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 chaquopy python 安卓
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 有没有帮写代码做实验仿真的
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥30 vmware exsi重置后登不上
    • ¥15 易盾点选的cb参数怎么解啊
    • ¥15 MATLAB运行显示错误,如何解决?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题