摘要: Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。... 阅读全文
posted @ 2015-07-26 19:15 无解大神 阅读(234) 评论(0) 推荐(0)
摘要: DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital l... 阅读全文
posted @ 2015-07-26 18:49 无解大神 阅读(131) 评论(0) 推荐(0)
摘要: Description某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、... 阅读全文
posted @ 2015-07-26 18:47 无解大神 阅读(234) 评论(0) 推荐(0)
摘要: The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, eac... 阅读全文
posted @ 2015-07-26 18:44 无解大神 阅读(253) 评论(0) 推荐(0)
摘要: Perhaps you all have heard the mythical story about Tower of Hanoi (The details of this story is not required to solve this problem): “There is a towe... 阅读全文
posted @ 2015-07-26 18:42 无解大神 阅读(195) 评论(0) 推荐(0)
摘要: Time Limit:1000MSMemory Limit:10000KTotal Submissions:3721Accepted:1290DescriptionA math instructor is too lazy to grade a question in the exam papers... 阅读全文
posted @ 2015-07-26 18:38 无解大神 阅读(228) 评论(0) 推荐(0)
摘要: DescriptionOn February, 30thnstudents came in the Center for Training Olympiad Programmers (CTOP) of the Berland State University. They came one by on... 阅读全文
posted @ 2015-07-26 18:33 无解大神 阅读(263) 评论(0) 推荐(0)
摘要: DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have ... 阅读全文
posted @ 2015-07-26 18:26 无解大神 阅读(274) 评论(0) 推荐(0)
摘要: DescriptionMike has many friends. Here are nine of them: Alice, Bob, Carol, Dave, Eve, Frank, Gloria, Henry and Irene.Mike is so skillful that he can ... 阅读全文
posted @ 2015-07-26 18:22 无解大神 阅读(300) 评论(0) 推荐(0)
摘要: DescriptionYou play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend on... 阅读全文
posted @ 2015-07-25 08:11 无解大神 阅读(551) 评论(0) 推荐(0)