摘要: Problem DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits.InputThe input f 阅读全文
posted @ 2013-10-11 21:52 persistent codeants 阅读(632) 评论(0) 推荐(0)
摘要: Problem DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(0 ≤K≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and tel 阅读全文
posted @ 2013-10-11 21:12 persistent codeants 阅读(177) 评论(0) 推荐(0)
摘要: Problem Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char map[1001][1001]; 8 int vis[1001. 阅读全文
posted @ 2013-10-11 20:38 persistent codeants 阅读(231) 评论(0) 推荐(0)