摘要: DescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are N north (up the page)S south (down the page)E east (to the right on the page)W west (to the left on the page) 阅读全文
posted @ 2012-03-04 18:40 狸の舞 阅读(193) 评论(0) 推荐(0) 编辑
摘要: DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and tel 阅读全文
posted @ 2012-03-04 18:38 狸の舞 阅读(149) 评论(0) 推荐(0) 编辑
摘要: DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor i,if you press the button "UP" , you will go up Ki floor,i.e,you will go to the i+K 阅读全文
posted @ 2012-03-04 18:35 狸の舞 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input1850Sample Output19210处理回溯问题,以及要在循环输入之前进行筛。View Code 1 #include<stdio.h> 2 #include<stdlib. 阅读全文
posted @ 2012-03-04 18:31 狸の舞 阅读(179) 评论(0) 推荐(0) 编辑