自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xuanweiace的博客

你必须非常努力,才能看起来毫不费力。

  • 博客(129)
  • 收藏
  • 关注

原创 【CodeForces - 1060C】Maximum Subrectangle (思维,预处理前缀和,dp,枚举长度)

题干:You are given two arrays aa and bb of positive integers, with length nn and mmrespectively.Let cc be an n×mn×m matrix, where ci,j=ai⋅bjci,j=ai⋅bj.You need to find a subrectangle of the matrix...

2018-10-31 22:05:01 550

原创 【CodeForces - 1027B 】Numbers on the Chessboard (没有营养的找规律题,无聊题)

题干:You are given a chessboard of size n×nn×n. It is filled with numbers from 11 to n2n2 in the following way: the first ⌈n22⌉⌈n22⌉ numbers from 11 to ⌈n22⌉⌈n22⌉ are written in the cells with even su...

2018-10-31 22:04:26 416

原创 【CodeForces - 205B 】Little Elephant and Sorting (思维)

题干:The Little Elephant loves sortings.He has an array a consisting of n integers. Let's number the array elements from 1 to n, then the i-th element will be denoted as ai. The Little Elephant can ...

2018-10-31 22:03:52 332

原创 【 HDU - 1796】How many integers can you find (容斥原理,二进制枚举或者dfs)

题干:  Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-in...

2018-10-31 22:03:36 223

原创 【CodeForces - 214B】Hometask (模拟,有坑)

题干:Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik so...

2018-10-31 22:03:14 377

原创 【CodeForces - 1051D】Bicolorings (dp,类似状压dp)

题干:You are given a grid, consisting of 22 rows and nn columns. Each cell of this grid should be colored either black or white.Two cells are considered neighbours if they have a common border and s...

2018-10-31 20:20:04 260

原创 【CodeForces - 1051C 】Vasya and Multisets (模拟)

题干:Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xxnice if it appears in the multiset exactly once. For example, multiset {1,1,2,3,3,3,4}{1,1,2,3,3,3,4} contains ...

2018-10-31 17:49:57 376

转载 贪心算法 -- 最小延迟调度

转自:https://blog.csdn.net/bqw18744018044/article/details/80285414总结:  首先,证明贪心的时候交换论证是万能的!其次,这一点如果要满足,也就是,如果你要用交换论证法,那么首先要保证交换逆序后,对其他的没有影响!如果有影响,那就只能像【POJ - 3253】Fence Repair 这道题一样,用优先队列...

2018-10-31 13:25:34 12620

原创 【qduoj - 142】 多重背包(0-1背包的另类处理,dp)

题干:ycb的ACM进阶之路Description   ycb是个天资聪颖的孩子,他的梦想是成为世界上最伟大的ACMer。为此,他想拜附近最有威望的dalao为师。dalao为了判断他的资质,给他出了一个难题。dalao把他带到一个到处都是题的oj里对他说:“孩子,这个oj里有一些不同的题,做每一道题都需要一些时间,每一题也有它自身的rp(人品值)。我会给你一段时间,在这段时间里,...

2018-10-30 22:07:07 240

原创 *【CodeForces - 768B】Code For 1 (分治策略,模拟二分思想,模拟线段树思想)

题干:Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a mae...

2018-10-30 22:04:33 423

原创 *【CodeForces - 202C 】Clear Symmetry (思维,找规律,特判)

题干:Consider some square matrix A with side n consisting of zeros and ones. There are nrows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matri...

2018-10-30 22:03:40 303

原创 【qduoj - 夏季学期创新题】最长公共子串(水题暴力枚举,不是LCS啊)

题干:描述 编写一个程序,求两个字符串的最长公共子串。输出两个字符串的长度,输出他们的最长公共子串及子串长度。如果有多个最长公共子串请输出在第一个字符串中先出现的那一个。特别注意公共子串中可能包含有空格,但不计回车符!输入两个字符串,回车结尾,每个字符串中都可能含有空格(每个字符串的长度不超过200个字符)输出一共有四行,前两行以Length of String1:...

2018-10-30 22:03:22 296

原创 【POJ - 3347 】Kadj Squares (计算几何,思维 或 扫描线)

题干:In this problem, you are given a sequence S1, S2, ..., Sn of squares of different sizes. The sides of the squares are integer numbers. We locate the squares on the positive x-y quarter of the pla...

2018-10-30 22:03:02 354

原创 SPFA算法模板

 简单的一个模板吧,留个底。如果要判负环的话,需要加一个cnt数组记录入队次数就可以了。void spfa(int st) { memset(dis,INF,sizeof dis); queue<int> q;q.push(st); dis[st]=0;vis[st]=1; while(!q.empty()) { int cur = q.front();q.pop()...

2018-10-30 22:00:31 348

原创 【CodeForces - 589F】Gourmet and Banquet (贪心,思维,二分)

题干:A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule: when each of the dishes will be served.For i-th of the dishes he knows two i...

2018-10-30 21:58:47 272

原创 【HDU - 1867 】A + B for you again(KMP,next数组应用)

题干:Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition bet...

2018-10-30 17:17:05 165

原创 【HDU - 3068】最长回文(Manacher算法,马拉车算法求最长回文子串)

题干:给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度len <= 110000Output每一行一个整数x...

2018-10-30 09:29:19 284

原创 【AtCoder - 4244 】AtCoder Express 2 (区间dp 或 暴力枚举,思维)

题干:In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses Mtrains, and the train i runs fro...

2018-10-29 23:49:15 410

原创 【POJ - 2001 】Shortest Prefixes (字典树,查询重复前缀区间)

题干:A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and "carbon". Note that the empty

2018-10-29 23:48:47 168

原创 【HDU - 1251 】统计难题(字典树,求拥有公共前缀的字符串数量)

题干:Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符...

2018-10-29 22:05:12 501

原创 【HDU - 2072 】单词数(字符串读入技巧,sstream大法,水题,字符串读入格式)

题干:lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。Output每组只输出一个整数,其单独成行,该整数代表一篇文章里不同单词的总数。Samp...

2018-10-29 21:25:10 272

原创 【AtCoder - 4242 】To Infinity(思维)

题干:Problem StatementMr. Infinity has a stringSconsisting of digits from1to9. Each time the date changes, this string changes as follows:Each occurrence of2inSis replaced with22. Simila...

2018-10-29 21:11:29 299

原创 【FZU - 1759】Super A^B mod C (数论,快速幂,快速乘,欧拉降幂,指数循环节,模板)

题干:Given A,B,C, You should quickly calculate the result of A^B mod C. (1&lt;=A,C&lt;=1000000000,1&lt;=B&lt;=10^1000000).InputThere are multiply testcases. Each testcase, there is one line contai...

2018-10-29 00:00:59 227

原创 【POJ - 1696】Space Ant (凸包,最小极角,排序)

题干:The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y1999 and called it M11. It has only one eye on the l...

2018-10-29 00:00:47 252

原创 【POJ - 1556】The Doors (计算几何,线段相交)

题干:You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y = 10. The initial and final point...

2018-10-29 00:00:36 227

原创 【POJ - 2663】Tri Tiling (简单dp)

题干:In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. InputInput consists of several test cases followed by a line containing -1. Ea...

2018-10-29 00:00:20 230

原创 【牛客 - 125A】灰魔法师(打表,暴力)

题干:给出长度为n的序列a, 求有多少对数对 (i, j) (1 &lt;= i &lt; j &lt;= n) 满足 ai + aj 为完全平方数。输入描述:第一行一个整数 n (1 &lt;= n &lt;= 105)第二行 n 个整数 ai (1 &lt;= ai &lt;= 105)输出描述:输出一个整数,表示满足上述条件的数对个数。 示例1输入复...

2018-10-29 00:00:09 201

原创 【qduoj - 夏季学期创新题】矩形剖分(递归,dp)

题干:描述 对一个给定的矩形,将其划分成尽可能少的正方形,输出正方形的最少个数。例如,如下图所示的情况,则输入为3和4,输出为4。输入 输入两个整数中间用空格分开。输出 输出最少分割成的正方形的个数。输入样例 1 3 4输出样例 14解题报告:   简单递归。  这题如果是t组数据的话,这个f函数就可以写记忆化了。。。但是这个题就没必...

2018-10-27 09:47:09 516

原创 【qduoj - 夏季学期创新题】骑士游历(递推dp)

 题干:描述 输入 输入包含多组数据,第一行T表示数据组数接下来每行六个整数n,m,x1,y1,x2,y2(分别表示n,m,起点坐标,终点坐标)输出 输出T行,表示起点到终点的路径数输入样例 1 130 30 1 15 3 15输出样例 12解题报告:    这题刚开始想用dfs来写,结果发现数字一大,连结果都跑不出来,再看题、、马...

2018-10-27 09:43:56 402

原创 【CodeForces - 124D】Squares (旋转坐标系,计算几何,思维)

题干:You are given an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using the shortest path is not necessary. You can move on the field squares in four directio...

2018-10-27 00:56:07 471

原创 【POJ - 3253】Fence Repair(贪心,时光倒流)

题干:DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer ...

2018-10-27 00:55:16 419

原创 【51Nod - 1094】和为k的连续区间 (前缀和,二分查找)

题干:一整数数列a1, a2, ... , an(有正有负),以及另一个整数k,求一个区间i,ji,j,(1 &lt;= i &lt;= j &lt;= n),使得aii + ... + ajj = k。Input第1行:2个数N,K。N为数列的长度。K为需要求的和。(2 &lt;= N &lt;= 10000,-10^9 &lt;= K &lt;= 10^9)第2 - N + 1行...

2018-10-27 00:54:55 446

原创 jsk Star War (线段树维护区间最小最大值 + 二分)

Description公元20XX年,人类与外星人之间的大战终于爆发。现有一个人类军团,由n名士兵组成,第i个士兵的战斗力值对应一个非负整数ai (1 \leq i \leq n1≤i≤n)。有一天,某个战力爆表的外星人NaN单独向地球人宣战,已知它的战力值为k (1 \leq k \leq 1e131≤k≤1e13)。现在该军团指挥官决定派遣编号在某个区间(l,r)内的士兵去与敌方决...

2018-10-27 00:54:33 228

原创 【POJ - 3304 】Segments(计算几何,思想转化,直线和线段相交)

题干:Given n segments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at least one p...

2018-10-27 00:43:30 207

原创 【POJ - 1269 】Intersecting Lines (计算几何,直线间的位置关系)

题干:We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) inte...

2018-10-27 00:29:20 231

原创 【POJ - 2398】Toy Storage (计算几何,二分找位置,叉积,点和直线的位置关系)

题干: Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangular box to put his toys in. Unfortunately, Reza is rebel...

2018-10-27 00:22:35 189

原创 【CodeForces - 202A】LLPS (思维,字符串)

题干:This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline.You are given string s consisting of lowercase English letters only. Fi...

2018-10-26 22:36:20 797

原创 C++关于引用的注意事项 总结知识点

对函数的引用:#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;queue&gt;#include&lt;map&gt;#include&lt;vector&gt;#include&lt;set&gt;#include&lt;string&gt;#include&lt;cmath&gt;#

2018-10-26 16:40:38 784

原创 【HDU - 2444】The Accomodation of Students(二分图判断 + 匈牙利算法求最大匹配)

题干:There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. But this may not imply that A and C know each o...

2018-10-25 22:53:16 269

原创 【HDU - 1083 】Courses (二分图)

题干:Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students th...

2018-10-25 22:52:49 181

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除