编程介的小学生 2019-02-18 00:23 采纳率: 20.5%
浏览 335

N个骑士的问题,方块涂色,采用C语言解决的思路是什么

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 matlab用simulink求解一个二阶微分方程,要求截图
    • ¥30 matlab解优化问题代码
    • ¥15 写论文,需要数据支撑
    • ¥15 identifier of an instance of 类 was altered from xx to xx错误
    • ¥100 反编译微信小游戏求指导
    • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
    • ¥15 学不会递归,理解不了汉诺塔参数变化
    • ¥15 基于图神经网络的COVID-19药物筛选研究
    • ¥30 软件自定义无线电该怎样使用
    • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?