2013年7月30日
摘要: DescriptionGiven m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It's clear that we may get n ^ m this kind of sequences. Then we can calculate the sum of numbers in each sequence, and get n ^ m values. What w 阅读全文
posted @ 2013-07-30 15:02 straw_berry 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 3 #include 4 using namespace std; 5 6 int n,k,ans; 7 char map[10][10]; 8 int vis[10];//标记某列是否被访问 9 10 void dfs(i.. 阅读全文
posted @ 2013-07-30 08:26 straw_berry 阅读(319) 评论(0) 推荐(0) 编辑