编程介的小学生 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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型