![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
文章平均质量分 73
u011123263
这个作者很懒,什么都没留下…
展开
-
USACO ORZ
Problem DescriptionLike everyone, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new geometries are the favorite.I. M. Hei, the原创 2013-11-04 11:41:42 · 921 阅读 · 0 评论 -
数字排列
Problem DescriptionS得到了一个数,他认为相邻位上的数字与数字之间会产生不良影响,比如123,1和2之间产生一个不良影响值,2和3之间产生一个不良影响值。现在他想调整这个数每位的数字的顺序,使得最终得到的数的总的不良影响值最小,且没有前导0。 Input输入数据的第一行为T表示有T组数据。每组数据先输入一个整数n(0 Output对于每组数原创 2014-04-25 18:53:18 · 490 阅读 · 0 评论 -
字符序列
Problem Description从三个元素的集合[A,B,C]中选取元素生成一个N个字符组成的序列,使得没有两个相邻字的子序列(子序列长度=2)相同。例:N=5时ABCBA是合格的,而序列ABCBC与ABABC是不合格的,因为其中子序列BC,AB是相同的。对于由键盘输入的N(1Input输入有多组数据,每组数据只有一行为一个整数N。Output对于原创 2014-04-15 19:36:23 · 1020 阅读 · 0 评论 -
工作分配
Problem Description设有n件工作分配给n个人,将工作i分配给第j个人所需的费用为cij。试设计一个算法,为每一个人都分配一件不同的工作,并使总费用达到最小。Input输入有多组数据,每组数据的第一行有1个正整数n(1Output对于每组数据输出一行,这一行只包含一个整数,表示最小费用。Sample Input34 2 5原创 2014-03-06 21:22:07 · 669 阅读 · 0 评论 -
擅长排列的小明
描述小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明到底对不对。输入第一行输入整数N(1每组测试数据第一行两个整数 n m (1输出在1-n中选取m个字符进行全排列,按字典序全部输出,每种排列占原创 2013-12-29 21:29:35 · 429 阅读 · 0 评论 -
自然数拆分
Problem Description任何一个大于1的自然数n,总可以拆分成若干个小于n的自然数之和。Input输入有多组数据,对于每组数据就一个数n。Output对于每组输入输出n的拆分方法。Sample Input4Sample Output1+1+1+11+1+21+32+2/* 解题报告:4原创 2013-12-02 20:17:38 · 1830 阅读 · 0 评论 -
循环比赛日程表
Problem Description设有N个选手进行循环比赛,其中N=2^M,要求每名选手要与其他N-1名选手都赛一次,每名选手每天比赛一次,循环赛共进行N-1天,要求每天没有选手轮空。Input输入第一行为T,表示数据组数,对于每组数据就一个M(1Output对于每组输入的M,输出表格形式的比赛安排表Sample Input13原创 2013-11-25 20:24:36 · 1077 阅读 · 0 评论 -
Prime Ring Problem
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime原创 2013-11-10 22:22:43 · 622 阅读 · 0 评论 -
Robot Motion
A 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原创 2013-10-21 21:22:31 · 536 阅读 · 0 评论 -
N皇后问题
在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。原创 2013-10-21 21:09:34 · 504 阅读 · 0 评论 -
Fire Net
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle原创 2013-11-03 20:53:04 · 389 阅读 · 0 评论 -
LianLianKan
Problem DescriptionI like playing game with my friend, although sometimes looks pretty naive. Today I invent a new game called LianLianKan. The game is about playing on a number stack.Now we hav原创 2013-11-04 09:39:10 · 491 阅读 · 0 评论 -
K圆
Problem DescriptionA single cycle is a closed simple path, with no other repeated vertices or edges other than the starting and ending vertices. The length of a cycle is the number of vertices on it.原创 2014-07-31 15:58:52 · 380 阅读 · 0 评论