08 2017 档案
摘要:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1103 No solution的情况是不存在的,如果n个数中存在8的倍数,那么直接输出这个数就好了,如果不存在,n个数对n取余,因为不存在余数为0,所以共n-1种余数,n个
阅读全文
摘要:835D:http://codeforces.com/problemset/problem/835/D emmmm不太会,附大佬代码
阅读全文
摘要:839C:http://codeforces.com/problemset/problem/835/C 题意:给出星星的个数,最大亮度(每时间+1,亮度+1,但不超过最大亮度),观测者观测的次数及时刻, 求观测时刻矩形内星星的亮度和。 这里要用到一个三维数组,一维记录时间,另外两维记录时间t时坐标(
阅读全文
摘要:51NOD 1277:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1277 跟HDU 6153还挺像的:http://www.cnblogs.com/Egoist-/p/7435573.html 相比与上面那个题,这个还
阅读全文
摘要:HDU6153:http://acm.hdu.edu.cn/showproblem.php?pid=6153 Orz 果然字符串很神奇……(神奇到人哭出来啊TAT)果然算法理解的不够透彻的话,是无法灵活运用的QAQ 其实只要简单的改一点点KMP的地方…… KMP的next[i]存储的是模式串下标0至
阅读全文
摘要:HDU1251:http://acm.hdu.edu.cn/showproblem.php?pid=1251 初学字典树,码模板…… HDU 2846 http://acm.hdu.edu.cn/showproblem.php?pid=2846 字典树原本是按前缀搜索的,题中所要求查询的并不一定是字
阅读全文
摘要:HDU 3068 http://acm.hdu.edu.cn/showproblem.php?pid=3068 HDU 3294http://acm.hdu.edu.cn/showproblem.php?pid=3294 感觉DP相对实现起来更简洁一些,很容易想到,可以用bool dp[i][j]:
阅读全文
摘要:有N种物品,每种物品的数量为C1,C2……Cn。从中任选若干件放在容量为W的背包里,每种物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 Input 第1行,2个整数,N和W中间用空格隔开。N为物品的种类,W为背包的容量。(
阅读全文
摘要:Problem Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。 话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有
阅读全文
摘要:Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concate
阅读全文
摘要:The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies
阅读全文
摘要:医学界发现的新病毒因其蔓延速度和Internet上传播的"红色病毒"不相上下,被称为"红色病毒",经研究发现,该病毒及其变种的DNA的一条单链中,胞嘧啶,腺嘧啶均是成对出现的。 现在有一长度为N的字符串,满足一下条件: (1) 字符串仅由A,B,C,D四个字母组成; (2) A出现偶数次(也可以不出
阅读全文
摘要:一个M*N的矩阵,找到此矩阵的一个子矩阵,并且这个子矩阵的元素的和是最大的,输出这个最大的值。 例如:3*3的矩阵: -1 3 -1 2 -1 3 -3 1 2 和最大的子矩阵是: 3 -1 -1 3 1 2 Input第1行:M和N,中间用空格隔开(2 <= M,N <= 500)。 第2 - N
阅读全文
摘要:给出N个正整数,找出N个数两两之间最大公约数的最大值。例如:N = 4,4个数为:9 15 25 16,两两之间最大公约数的最大值是15同25的最大公约数5。 Input第1行:一个数N,表示输入正整数的数量。(2 <= N <= 50000) 第2 - N + 1行:每行1个数,对应输入的正整数.
阅读全文
摘要:Given a N × N matrix A, whose element in the i-th row and j-th column Aij is an number that equals i2 + 100000 × i + j2 - 100000 × j + i × j, you are
阅读全文
摘要:Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope wa
阅读全文
摘要:It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. Jane has dec
阅读全文
摘要:恢复内容开始 说起二分,最基础的二分搜索算法就不用了吧(最难的还际应用啊感觉)……实现起来很简单,搜索区间不断减半……唔……嘛……简单甩个模板好了(●'◡'●) 下面开始学习二分的几种应用啦~~ 1.假定一个解并判断是否可行 一般用于求解判断条件较为简单的最大化和最小化的问题,不断缩小答案的区间。
阅读全文
摘要:连连看 HDU - 1175 “连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看
阅读全文
摘要:Monkey and Banana HDU - 1069 A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a b
阅读全文
摘要:B. Godsend Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Player
阅读全文
摘要:A. Generous Kefa One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Ke
阅读全文
摘要:HDU 1024 Max Sum Plus Plus Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to mor
阅读全文
摘要:1.背包问题 (1)01背包 从n个重量和价值分别为wi,vi的物品,从中选出不超过W的物品,每种物品仅有一件,求所有方案中V的最大值。 最朴素最简单也最费时的方法:O(2^n) int rec(int i,int j)//从第i个开始挑选总重小于j的部分 递归 递归终止条件:i==n return
阅读全文
摘要:skiing 时间限制:3000 ms | 内存限制:65535 KB 难度:5 描述 Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二
阅读全文