- 博客(11)
- 收藏
- 关注
原创 贪心——区间调度——会场安排问题
会场安排问题时间限制:3000 ms | 内存限制:65535 KB难度:3描述学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办。小刘的工作就是安排学校小礼堂的活动,每个时间最多安排一个活动。现在小刘有一些活动计划的时间表,他想尽可能的安排更多的活动,请问他该如何安排。输入第一行是一个整型数m(m<100)表示共有m组测试数据。每组测试数据的...
2018-04-05 12:13:49 416
原创 贪心——单调递增最长子序列
描述求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4 输入第一行一个整数0<n<20,表示有n个字符串要处理随后的n行,每行有一个字符串,该字符串的长度不会超过10000输出输出字符串的最长递增子序列的长度样例输入3aaaababcabklmncdefg样例输出137#include<iostream>#include<...
2018-04-04 20:52:18 334
原创 BFS - Catch That Cow(并列进行)
Farmer 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,0
2018-02-01 11:21:52 227
原创 DP-数字三角
下图是个数字三角,请编写一个程序计算从顶部至底部某处一条路径,使得该路径所经过的数字总和最大。73 88 1 02 7 4 41. 每一步可沿左斜线向下或右斜线向下走;2. 13. 三角形中的数字为整数 0,1,……,99。4. 如果有多种情况结果都最大,任意输出一种即可。 输入:第
2018-01-28 21:26:18 254
原创 BFS - Rescue ZOJ - 1649
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M Angel's friends want to save Angel. Their task is: approach Angel. We assume that "approach
2018-01-28 20:31:35 351
原创 BFS - Knight Moves
Background Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him? The Problem Your task is to write
2018-01-28 20:18:41 236
原创 DFS - Red and Black
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can'
2018-01-28 20:00:46 278
原创 DFS- Prime Ring Problem
A 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. Note: the number
2018-01-28 19:45:46 201
原创 DFS-N皇后问题
在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample
2018-01-28 19:23:47 238
原创 STL-B-集合问题
There are n pearls in a row. Let's enumerate them with integers from 1 to n from the left to the right. The pearl number i has the type ai.Let's call a sequence of consecutive pearls a segment. Le
2018-01-22 21:49:58 240
原创 STL-A-堆栈问题
You are given string s consists of opening and closing brackets of four kinds , {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same t
2018-01-22 21:29:37 212
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人