ACM解题
文章平均质量分 70
二喵君
菜的不安详
展开
-
HDU 5536 Chip Factory【暴力大法好】
题目:John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory pro...原创 2019-01-16 14:02:46 · 353 阅读 · 1 评论 -
题目C--Competition - 20181010
题目Let's call the following process a transformation of a sequence of length nn.If the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the elements ...原创 2018-10-11 22:24:06 · 195 阅读 · 0 评论 -
题解--the empty sequence is a regular
We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are regular brac...原创 2018-09-03 13:42:30 · 536 阅读 · 0 评论 -
题解--Halloween Costumes (LightOJ 1422)
Halloween CostumesSubmit StatusDescriptionGappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Hallo...原创 2018-09-01 21:34:19 · 390 阅读 · 0 评论 -
整数划分(四)
碰着一道区间dp,看着不难,就是不明白,强制性输出,明白一丢丢:原代码链接:https://blog.csdn.net/my_sunshine26/article/details/77141398【题意】给出一个数n,要求在n的数位间插入(m-1)个乘号,将n分成了m段,求这m段的最大乘积。 原代码:#include <cstdio>#include <...原创 2018-08-21 21:45:56 · 210 阅读 · 0 评论 -
英文题中--词
由于我的英语水平应该会持续不怎么样,这篇应该是一直更更更的。 degrees || 精度,深度determine || 下决心,作出决定array || 数组,队列;occurs || 发生,被想起,被发现exactly || 恰恰。确切的contiguous || 接触的,邻接的,共同的costume || 服装,穿衣blends || 混合,掺和,协调c...原创 2018-08-31 21:11:02 · 114 阅读 · 0 评论 -
离线操作
参考资料:https://www.xuebuyuan.com/3204865.html在线算法和离线算法的概念一、在线算法 在计算机科学中,一个在线算法是指它可以以序列化的方式一个个的处理输入,也就是说在开始时并不需要已经知道所有的输入。相对的,对于一个离线算法,在开始时就需要知道问题的所有输入数据,而且在解决一个问题后就要立即输出结果。例如,选择排序在排序前就需要知道所有待排序元素...转载 2018-08-31 00:03:04 · 537 阅读 · 0 评论 -
混合三种背包问题实例:
混合三种背包问题实例:正经代码:/*旅行者有一个容量为V公斤的背包n :物品种数w :物品重量c :物品价值p :物品可以拿取的数目(0表示可取无穷多件)输入样例:10 32 1 03 3 14 5 4输出样例:11*/#include<cstdio>#include<iostream>using namespace s...原创 2018-08-18 20:36:15 · 3528 阅读 · 0 评论 -
题解--NOIP提高组2004 合并果子
题目描述在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所耗体力之和。因为还要花大力气把这些果子搬回家,所以多多在合并果子时要尽可能地节省体力。假定每...原创 2018-02-01 23:30:20 · 456 阅读 · 0 评论 -
杭电 汉诺塔问题总结
参看资料:https://blog.csdn.net/xueerfei008/article/details/9904681看了一下杭电的各种汉诺塔问题,遇到些奇奇葩葩的小问题,也有很多很好的思想,比如最后一题,来来回回的颠倒很有意思。总结一下;Pro.ID 1207 :http://acm.hdu.edu.cn/showproblem.php?pid=1207意思是给把原始的汉诺塔问...转载 2018-08-12 18:47:46 · 270 阅读 · 0 评论 -
题解--You are given a set of nn segments on the axis Ox--个性的点(水)
网址:https://cn.vjudge.net/contest/243309#problem/AYou are given a set of n segments on the axis Ox, each segment has integer endpoints between 11 and mm inclusive. Segments may intersect, overlap or ...原创 2018-08-02 22:23:48 · 1106 阅读 · 0 评论 -
题目D--Competition - 20181010
题目 There is a forest that we model as a plane and live nn rare animals. Animal number iihas its lair in the point (xi,yi)(xi,yi). In order to protect them, a decision to build a nature reserve has ...原创 2018-10-11 23:54:59 · 178 阅读 · 0 评论 -
题目A-Competition - 20181017
题目:https://vjudge.net/contest/262776#problem/A水题,题意:从1-n,能被v整除的点上有灯笼,一列火车从点 l - 点 r,问能看到多少灯笼。思路:开始没注意数据范围 ,直接以v为循环间隔,落入l-r区间内的舍去,其他计数。然后超时了。换思路,直接用“x”除以间隔v,得到1-x中灯的个数,相减几次可得所有可见的灯笼。//注意特判边缘覆盖情况。...原创 2018-10-17 22:58:06 · 173 阅读 · 0 评论 -
寒假训练1【总结】
A》POJ2891【中国剩余定理】: https://blog.csdn.net/sodacoco/article/details/86482567B》POJ 3080【KMP+暴力枚举】: https://blog.csdn.net/sodacoco/article/details/86482567C》POJ 1515 Street Directions 【边...原创 2019-01-21 11:51:58 · 139 阅读 · 0 评论 -
寒假训练6【总结】
1》HDU 5500 Reorder the Books【思维】: https://blog.csdn.net/sodacoco/article/details/865834352》HDU 5438 Ponds【拓扑排序+BFS】: https://blog.csdn.net/sodacoco/article/details/865867393》LightOJ ...原创 2019-01-23 23:54:14 · 179 阅读 · 0 评论 -
内存泄漏是什么
参看资料:https://www.cnblogs.com/mfrbuaa/p/3851742.html1. 什么是内存泄漏(memory leak)? 指因为疏忽或错误造成程序未能释放已经不再使用的内存的情况。内存泄漏并不是指内存在物理上的消失,而是应用程序分配某段内存后,因为设计错误,失去了对该段内存的控制,因而造成了内存的浪费。 A memory leak is a p...原创 2019-01-12 16:32:08 · 3174 阅读 · 0 评论 -
寒假训练2【总结】
1》HDU 4810 Wall Painting【组合数+二进制拆分】: https://blog.csdn.net/sodacoco/article/details/864975772》HDU 5573 Binary Tree【二进制思维题】: https://blog.csdn.net/sodacoco/article/details/864981383》H...原创 2019-01-17 10:11:34 · 177 阅读 · 0 评论 -
HDU - 1312 【DFS】(别踩红块儿~)
觉得自己把深搜忘干净了,递归着递归着就会了呢~【虽然改了贼久。。】最简单深搜~题目描述: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 ...原创 2018-11-19 01:34:37 · 236 阅读 · 0 评论 -
Competition - 20181031
题目A:You are given a string ss, consisting of nn lowercase Latin letters.A substring of string ss is a continuous segment of letters from ss. For example, "defor" is a substring of "codeforces" an...原创 2018-11-01 00:59:49 · 296 阅读 · 0 评论 -
Competition - 20181024
题目AMasha has three sticks of length aa, bb and cc centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break s...原创 2018-10-24 23:19:47 · 403 阅读 · 0 评论 -
题目B--Competition - 20181010
题目Student Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subject. Obviously, it is impossible to do this by legal means,...原创 2018-10-11 00:29:34 · 221 阅读 · 0 评论 -
题目A--Competition - 20181010
题目/*Vasya has recently got a job as a cashier at a local store.His day at work is L minutes long.Vasya has already memorized n regular customers,the i-th of which comes after ti minutes after the ...原创 2018-10-10 23:47:50 · 268 阅读 · 0 评论 -
题目B-Competition - 20181017
题目Vova's house is an array consisting of nn elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The ii-th elemen...原创 2018-10-19 00:12:03 · 452 阅读 · 0 评论 -
序数词的写法
尾数是1的加st 除了11是加th尾数是2的加nd除了12是加th尾数是3的加rd除了13是加th其余的全部th原创 2018-04-01 09:13:45 · 1690 阅读 · 0 评论 -
tarjan算法讲解
全网最详细tarjan算法讲解,我不敢说别的。反正其他tarjan算法讲解,我看了半天才看懂。我写的这个,读完一遍,发现原来tarjan这么简单!tarjan算法,一个关于 图的联通性的神奇算法。基于DFS(迪法师)算法,深度优先搜索一张有向图。!注意!是有向图。根据树,堆栈,打标记等种种神(che)奇(dan)方法来完成剖析一个图的工作。而图的联通性,就是任督二脉通不通。。的问题。了解ta...转载 2018-04-22 08:23:05 · 134 阅读 · 0 评论 -
彻底弄懂最短路径问题(转载)
原文链接:http://www.cnblogs.com/hxsyl/p/3270401.html(真的很棒,比心) 只想说:温故而知新,可以为师矣。我大二的《数据结构》是由申老师讲的,那时候不怎么明白,估计太理论化了(ps:或许是因为我睡觉了);今天把老王的2011年课件又看了一遍,给大二的孩子们又讲了一遍,随手谷歌了N多资料,算是彻底搞懂了最短路径问题。请读者尽情享用…… ...转载 2018-04-22 09:08:59 · 2601 阅读 · 0 评论 -
题目—bought a new car!One day he comes to avertical corner.
Problem EProblem DescriptionMr. West bought a new car! Sohe is travelling around the city.<br><br>One day he comes to avertical corner. The street he is currently in has a width x, the str...原创 2018-03-19 15:04:53 · 579 阅读 · 0 评论 -
题目-My birthday is coming up and traditionally I'm serving pie.
Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my...原创 2018-03-19 11:12:03 · 3858 阅读 · 0 评论 -
题解-calculate the angle
Problem DescriptionThe recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing, climbing, and so on.<br>We all like to...原创 2018-03-17 10:15:39 · 318 阅读 · 0 评论 -
题解-F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x
Problem DescriptionNow, here is a fuction:<br>&nbsp;&nbsp;F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 &lt;= x &lt;=100)<br>Can you find the minimum value when x is between 0 an...原创 2018-03-17 09:58:50 · 4622 阅读 · 3 评论 -
题解-equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y;
Problem DescriptionNow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;<br>Now please try your lucky. InputThe first line of the input contain...原创 2018-03-17 09:24:38 · 5257 阅读 · 0 评论 -
C++中cos,sin,asin,acos这些三角函数操作
http://blog.csdn.net/xky140610205/article/details/52192889C++中cos,sin,asin,acos这些三角函数操作的是弧度,而非角度,你需要把角度转化为弧度.弧度=角度*Pi/180;例子1:比如对边和邻边分别为a,b 设角度为x,则 x=atan(a/b); 其中x为弧度制 如需转换为角度值,则x*180/3.1415例子2: //...转载 2018-03-17 08:07:48 · 18365 阅读 · 0 评论 -
题目--台阶问题
题目描述有N级的台阶,你一开始在底部,每次可以向上迈最多K级台阶(最少1级),问到达第N级台阶有多少种不同方式。输入输出格式输入格式:输入文件的仅包含两个正整数N,K。输出格式:输入文件stair.out仅包括1个正整数,为不同方式数,由于答案可能很大,你需要输出mod 100003后的结果。输入输出样例输入样例#1: 5 2 输出样例#1: 8说明对于20%的数据,有N ≤...原创 2018-03-02 10:35:17 · 1522 阅读 · 0 评论 -
next_permutation-做题之看不懂题解
以一道题打头:将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数的比例是A:B:C,试求出所有满足条件的三个三位数,若无解,输出“No!!!”。解:1- 每个数不可重复 ;2- 比例未定;3- 三个数都为三位数;可以枚举(123-327),根据A:B:C这一比例得到其余两个数(判断能否整除),然后用一bool类型数组标记,判断是否符合1-9这一要求。(判断九个数是否刚好为1-9...原创 2018-03-16 00:18:47 · 274 阅读 · 0 评论 -
题解--洛谷P1181 数列分段 Section I
题目描述对于给定的一个长度为N的正整数数列A[i],现要将其分成连续的若干段,并且每段和不超过M(可以等于M),问最少能将其分成多少段使得满足要求。 输入格式:输入文件divide_a.in的第1行包含两个正整数N,M,表示了数列A[i]的长度与每段和的最大值,第2行包含N个空格隔开的非负整数A[i],如题目所述。输出格式:输出文件divide_a.out仅包含一个正整数,...原创 2018-02-02 00:03:19 · 2341 阅读 · 0 评论 -
题解--洛谷 P1208 [USACO1.3] 混合牛奶 Mixing Milk
题目描述由于乳制品产业利润很低,所以降低原材料(牛奶)价格就变得十分重要。帮助Marry乳业找到最优的牛奶采购方案。Marry乳业从一些奶农手中采购牛奶,并且每一位奶农为乳制品加工企业提供的价格是不同的。此外,就像每头奶牛每天只能挤出固定数量的奶,每位奶农每天能提供的牛奶数量是一定的。每天Marry乳业可以从奶农手中采购到小于或者等于奶农最大产量的整数数量的牛奶。给出Marry乳业每天...原创 2018-02-02 11:37:16 · 823 阅读 · 0 评论 -
题解-Inhabitants of the Wonderlandhave decided to hold a regional programming contest.
Problem DescriptionInhabitants of the Wonderlandhave decided to hold a regional programming contest. The Judging Committee has volunteeredand has promised to organize the most honest contest ever. It ...原创 2018-03-19 20:45:04 · 2651 阅读 · 0 评论 -
题解—detecting underground oil deposits
Problem DescriptionThe GeoSurvComp geologicsurvey company is responsible for detecting underground oil deposits.GeoSurvComp works with one large rectangular region of land at a time, and creates a gri...原创 2018-03-20 15:40:40 · 2471 阅读 · 0 评论 -
扩展欧几里德算法 递归和非递归实现及证明
关于欧几里得算法,贝祖等式,扩展欧几里得算法,Wikipedia的解释非常非常详细了。 另外,看了好多别人优秀的总结,我认为最详尽的就是ACM之家的总结。 这里自己再总结一次…实际上就是把别人总结的,我认为有助于自己理解的内容copy过来,再加上几句自己的理解。本文包括:欧几里德算法 递归实现 欧几里德算法 非递归实现 贝祖等式 扩展欧几里德算法 递归实现 扩展欧几里德算法 非...转载 2018-08-01 07:47:57 · 2575 阅读 · 1 评论 -
动态规划解最长公共子序列问题
原网页:https://blog.csdn.net/yysdsyl/article/details/4226630动态规划法经常会遇到复杂问题不能简单地分解成几个子问题,而会分解出一系列的子问题。简单地采用把大问题分解成子问题,并综合子问题的解导出大问题的解的方法,问题求解耗时会按问题规模呈幂级数增加。为了节约重复求相同子问题的时间,引入一个数组,不管它们是否对最终解有用,把所有子问题...转载 2018-07-27 21:02:57 · 284 阅读 · 0 评论