随笔分类 -  算法练习

摘要:题目大意:在一个10x15的方阵里填满了RGB三种小球,要求:1、找到最大的一片相同颜色区域,并删掉,(这片区域相同颜色球必须相邻,且相邻数大于1)。2、删除完成后,其他小球自然下落填充。先每列向下填充,空的列由右边一列平移补全。3、当区域内没有球或最大相邻区域的个数为一,游戏结束。 题解: 主函数 阅读全文
posted @ 2018-02-24 15:11 proscientist
摘要:英文题意描述: James has a grid plate of size N×N. And non-negative integers are written on each grid unit of the plate. As James hates when there are too ma 阅读全文
posted @ 2018-01-16 09:03 proscientist
摘要:非常经典的模拟题,首先需要建立120°坐标系,然后dfs 以下是AC的代码 阅读全文
posted @ 2018-01-16 08:47 proscientist
摘要:这次的题目是VH难度,难度很大,不过啃下来的收获也颇多。 题意: 给出3*10^5个员工的工资,工资范围10^9,所有员工的工资必须满足如下约束:每个员工的工资不能高于其上司的工资,否则就要给其上司涨工资,使上司的工资和下属相同。 先一次给出每个员工的上司信息和工资,求涨工资的总次数。 详细描述如下 阅读全文
posted @ 2018-01-10 09:59 proscientist
摘要:完整题目描述: William received N colored pencils as a present. Each pencil’s color is a combination of red, green and blue. The color of the ith colored pen 阅读全文
posted @ 2017-12-28 16:56 proscientist
摘要:题目完整描述: You want to create a system to predict collapse of old buildings. Initial durability of all buildings is given and decreased every year by 1. 阅读全文
posted @ 2017-12-28 16:55 proscientist
摘要:Poj 2299 统计如果要对一串数据排序,冒泡排序需要交换多少次 即求逆序数,可以用树状数组或者归并排序求取。 /*POJ 2299 归并排序解法 求逆序对的数目可以使用归并排序,其实逆序对的数目是归并排序的一个附属产品,只是在归并排序的过程中顺便算出来的。 (2路)归并排序的思想:先把每个数看成 阅读全文
posted @ 2017-12-28 16:47 proscientist
摘要:/*POJ 1324 题意: 给出一个n*m的贪吃蛇地图,以及贪吃蛇现在身体各个块所在的位置,求它的头走到(1,1)位置最少需要多少步。 其中蛇在移动的过程中不能走到障碍物上,也不能撞到自己的身体上。 题解:写迷宫问题首先应该避免死循环,即相同状态不能多次入队。本次搜索状态不仅有蛇头的位置还有蛇身的 阅读全文
posted @ 2017-12-28 16:46 proscientist
摘要:题目:DFS练习题目 附上一道相似的题目,给定一些木棒,求可拼接出的最大矩形面积。 Execution time : 10 sec(C/C++) / 20 sec(JAVA) for 95 cases combinedMemory : Maximum 256MB available for heap 阅读全文
posted @ 2017-12-28 16:44 proscientist
摘要:完整英文题意: Froggy lives in a beautiful pond where there are N lotuses numbered from 1 to N in order. When looking down at the pond, it seems like the lot 阅读全文
posted @ 2017-12-28 16:40 proscientist
摘要:完整题目描述: Electronics Company owned by Dan has N employees.This year, the company has N new projects to work on.Each employee should be assigned to only 阅读全文
posted @ 2017-12-28 14:05 proscientist
摘要:完整题目描述: Monroe, Brad and William have been participating in Samsung TeamProgramming as a team. As always, they are getting ready for this year’s progr 阅读全文
posted @ 2017-12-28 14:04 proscientist