- 博客(300)
- 收藏
- 关注

原创 算法模板
文章目录DP部分01背包完全背包多重背包LISLCSDP部分01背包int dp[MAXN];for(int i=0;i<n;i++) for(int j=W;j>=w[i];j--) dp[j]=max(dp[j],dp[j-w[i]]+v[i]);printf("%d\n",dp[W]);完全背包int dp[MAXN];for(int i...
2019-05-11 12:09:09
710

原创 学习LaTeX数学公式的一些常用函数
在优快云优快云优快云里写博客 数学公式是必不可少的内容 恰好MarkdownMarkdownMarkdown支持LaTeXLaTeXLaTeX的语法 所以就学习一些常用的公式 记录下来,以便以后查看上下标^{上标}_{下标}\cdots和\dots是两种不同的点点点的表示方法x^2_1,x^2_2,x^2_3,\cdots,x^2_nx…xx…xx\do...
2018-07-24 17:04:15
9465
3
原创 快速排序
明天要面试,听说会考快速排序,预习一下/*选在一个基准数,比它小的在它的左边,比它大的在它的右边。(分治)然后再对左右两部分进行上面的操作一直到最后时间复杂度O(n^2)到O(nlogn)不是稳定的排序方式*/#include<bits/stdc++.h>using namespace std;void QuickSOrt(int a[], int start, int last){ if(start>=last) return ; i
2020-07-05 23:53:51
370
1
原创 codeforces gym 102058——————HPU ICPC国庆训练1
题目来源:https://codeforces.com/gym/102058目录E. FractionsL. Repetitive PalindromeM. Coke ChallengeE. Fractions官方题解:#include<bits/stdc++.h>using namespace std;typedef long long ll;ll A,B,C,...
2019-10-10 13:09:33
595
原创 图形学实验3——————简单种子填充算法
test#include<GL/glut.h>#include<stdio.h>#include<math.h>#include<windows.h>void init(void) { glClearColor(1.0, 1.0, 1.0, 0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(...
2019-10-06 20:39:43
1925
原创 2017 EC-Final 部分题解——————HPU ICPC国庆训练2
目录,点击即可跳转到相应题解[A. Chat Group](https://codeforces.com/gym/101775/problem/A)[C. Traffic Light](https://codeforces.com/gym/101775/problem/C)[K. Downgrade](https://codeforces.com/gym/101775/problem/K)[L. ...
2019-10-04 21:33:06
749
原创 洛谷 P3834 ——————【模板】可持久化线段树 1(主席树)
P3834 【模板】可持久化线段树 1(主席树)#include<bits/stdc++.h>using namespace std;const int MAXN = 2e5+7;int n, m, cnt, rt[MAXN], a[MAXN], x, y, k;struct node{int l,r,sum;} T[MAXN*30];vector<int> ...
2019-09-21 21:13:18
269
原创 HDU 2665 Kth number——————区间第k大,主席树
Kth numberTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21499 Accepted Submission(s): 6560Problem DescriptionGive you a sequence and a...
2019-09-21 17:28:43
188
原创 POJ 2761 Feed the dogs——————区间第K大,主席树
Feed the dogsTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 23591 Accepted: 7498DescriptionWind loves pretty dogs very much, and she has n pet dogs. So Jiajia has to feed the dogs eve...
2019-09-21 16:41:47
211
原创 POJ 2104 K-th Number——————主席树模板,区间第k大
K-th NumberTime Limit: 20000MS Memory Limit: 65536KTotal Submissions: 77307 Accepted: 27874Case Time Limit: 2000MSDescriptionYou are working for Macrohard company in data structures department....
2019-09-21 16:29:58
225
原创 图形学实验02——————画直线,椭圆,多边形
文章目录画直线画圆画椭圆画多边形画直线glBegin(GL_LINES) 接下来的两个点将连在一起 glBegin(GL_LINES); glVertex2f(-0.5f, 0.5f); glVertex2f(0.5f, -0.5f); glEnd();#include <GL/glut.h>#include <math.h>const int n =...
2019-09-19 18:29:34
902
原创 图形学实验01
#include <GL/glut.h> //需要正确安装GLUT,安装方法如预备知识中所述void myDisplay(void){ //glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f (1.0f...
2019-09-15 23:03:15
257
原创 牛客练习赛51 A-E
B 子串查询主要是学习了一下string 中 find 的用法#include<bits/stdc++.h>using namespace std;typedef long long ll;const int MAXN = 1e5+7;int main() { int n,q; string s; cin>>n...
2019-09-06 23:48:50
295
原创 The Preliminary Contest for ICPC Asia Nanjing 2019
H - Holy GrailAs the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of sixty years...
2019-09-04 15:56:11
260
原创 AtCoder Beginner Contest 139
文章目录[A - Tenki](https://atcoder.jp/contests/abc139/tasks/abc139_a)[B - Power Socket](https://atcoder.jp/contests/abc139/tasks/abc139_b)[C - Lower](https://atcoder.jp/contests/abc139/tasks/abc139_c)[D ...
2019-09-04 15:08:14
939
原创 河南理工2019暑期选拔赛————我好菜
文章目录[Problem A 小L的项链切割](http://acm.zzuli.edu.cn/problem.php?id=1526)[Problem B 小L的试卷](http://acm.zzuli.edu.cn/problem.php?id=1527)[Problem C 小L记单词](http://acm.zzuli.edu.cn/problem.php?id=2041)[Prob...
2019-08-13 21:17:23
470
原创 leetcode第 149 场周赛 1155. 掷骰子的N种方法
掷骰子的N种方法这里有 ddd 个一样的骰子,每个骰子上都有 fff 个面,分别标号为 1,2,...,f1, 2, ..., f1,2,...,f。我们约定:掷骰子的得到总点数为各骰子面朝上的数字的总和。如果需要掷出的总点数为 targettargettarget,请你计算出有多少种不同的组合情况(所有的组合情况总共有fdf^dfd 种),模 109+710^9 + 7109+7 后返回。...
2019-08-11 16:34:23
389
原创 AtCoder Beginner Contest 137 D - Summer Vacation——————贪心,优先队列
abc137_D - Summer VacationProblem StatementThere are NNN one-off jobs available. If you take the i-th job and complete it, you will earn the reward of BiB_iBi after AiA_iAi days from the day you ...
2019-08-10 23:55:03
620
原创 POJ 2976 Dropping tests —————— 01分数规划,二分
POJ 2976 Dropping tests给出n个a和b,让选出n-k个使得 100∗∑i=1nai∑i=1nbi100*\frac{\sum_{i=1}^{n} a_i}{\sum_{i=1}^{n}b_i}100∗∑i=1nbi∑i=1nai 最大01规划问题,看这里看完就会了这里用的是二分的方法/*--------- Hongjie ----------*//**...
2019-08-08 18:04:50
240
原创 BZOJ 1113 海报PLA——————单调栈
BZOJ 1113 海报PLADescriptionN个矩形,排成一排. 现在希望用尽量少的矩形海报Cover住它们.Input第一行给出数字N,代表有N个矩形.N在[1,250000] 下面N行,每行给出矩形的长与宽.其值在[1,1000000000]2 1/2 PosteringOutput最少数量的海报数.Sample Input51 21 32 22 51 4...
2019-08-08 17:43:26
319
原创 POJ 2559 Largest Rectangle in a Histogram ——————单调栈
POJ 2559 Largest Rectangle in a Histogram现在有 nnn 个宽度为 111 ,高度分别为h1,h2,...,hnh_1,h_2,...,h_nh1,h2,...,hn的长方形从左到右组成的柱状图。问里面包含的长方形的最大面积是多少?下图对应的样例72 1 4 5 1 3 3结果是 8 ,图中阴影部分用单调栈来维护以hih_ihi为高度...
2019-08-08 17:30:42
222
原创 POJ 3250 Bad Hair Day——————单调栈
POJ 3250 Bad Hair DayFarmer John的奶牛在风中凌乱了它们的发型……每只奶牛都有一个身高hi(1≤hi≤1,000,000,000)hi(1 ≤ hi ≤ 1,000,000,000)hi(1≤hi≤1,000,000,000),现在在这里有一排全部面向右方的奶牛,一共有NNN只(1≤N≤80,000)(1 ≤ N ≤ 80,000)(1≤N≤80,000)。对于奶...
2019-08-08 16:57:29
264
原创 HDU 6608 Fansblog——————大素数检测
FansblogTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 702 Accepted Submission(s): 247Problem DescriptionFarmer John keeps a website cal...
2019-08-03 14:48:55
1407
原创 POJ 3187 Backward Digit Sums——————全排列暴力水题
Backward Digit SumsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10751 Accepted: 6056DescriptionFJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (...
2019-07-29 08:32:44
209
原创 POJ 3050 Hopscotch——————dfs
HopscotchTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6738 Accepted: 4338DescriptionThe cows play the child’s game of hopscotch in a non-traditional way. Instead of a linear set of ...
2019-07-29 08:29:18
200
原创 POJ 3669 Meteor Shower——————bfs
Meteor ShowerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 31235 Accepted: 8037DescriptionBessie hears that an extraordinary meteor shower is coming; reports say that these meteors w...
2019-07-29 08:25:06
195
原创 HDU 3949 XOR——————线性基
XORTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6800 Accepted Submission(s): 2379Problem DescriptionXOR is a kind of bit operator, we ...
2019-07-25 21:01:44
203
原创 HDU 6582 Path——————2019多校第一场,最短路+最大流
PathTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1831 Accepted Submission(s): 496Problem DescriptionYears later, Jerry fell in love ...
2019-07-23 19:26:33
378
原创 HDU 6581 Vacation——————2019多校第一场,思维
VacationTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1060 Accepted Submission(s): 420Special JudgeProblem DescriptionTom and Jerry...
2019-07-23 09:36:08
251
原创 zzuli 1530 小L玩滚球游戏——————思维
1530: 小L玩滚球游戏时间限制: 1 Sec 内存限制: 128 MB提交: 54 解决: 18题目描述小L正在玩滚球游戏,有n个水晶球在轨道上以不同开始位置和速度从近往远的方向滚动,如果两个水晶球在滚动过程中相遇,它们就会融合成一个水晶球,然后以速度较慢的水晶球的速度继续向前滚动, 问经过时间t后,轨道上还有多少水晶球。输入第一行输入两个整数n、t,n代表水晶球的数量(1 &...
2019-07-23 08:27:34
452
原创 Aize 0558 Cheese——————BFS
Cheese問題在H * W的地图上有N个奶酪工厂,每个工厂分别生产硬度为1-N的奶酪。有一只老鼠准备从出发点吃遍每一个工厂的奶酪。老鼠有一个体力值,初始时为1,每吃一个工厂的奶酪体力值增加1(每个工厂只能吃一次),且老鼠只能吃硬度不大于当前体力值的奶酪。 老鼠从当前格到上下左右相邻的无障碍物的格需要时间1单位,有障碍物的格不能走。走到工厂上时即可吃到该工厂的奶酪,吃奶酪时间不计。问吃遍所有奶...
2019-07-20 19:46:41
197
原创 POJ 3009 Curling 2.0——————dfs
Curling 2.0今年的奥运会之后,在行星mm-21上冰壶越来越受欢迎。但是规则和我们的有点不同。这个游戏是在一个冰游戏板上玩的,上面有一个正方形网格。他们只用一块石头。游戏的目的是让石子从起点到终点,并且移动的次数最小图1显示了一个游戏板的例子。一些正方形格子可能被砖块占据。有两个特殊的格子,起始点和目标点,这是不占用块。(这两个方块是不同的)一旦石头开始移动就不会停下,除非它击中砖块块...
2019-07-20 16:27:16
322
原创 POJ 3169 Layout——————简单差分约束(转化为最短路)
LayoutTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 17094 Accepted: 8231DescriptionLike everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 &l...
2019-07-20 09:15:53
248
原创 POJ 3723 Conscription——————求森林最大权
ConscriptionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 19544 Accepted: 6794DescriptionWindy has a country, and he wants to build an army to protect his country. He has picked up N...
2019-07-19 20:06:19
188
原创 SPOJ - GCJ1C09C 释放囚犯 ——————区间dp
GCJ1C09C - Bribe the PrisonersProblemIn a kingdom there are prison cells (numbered 1 to P) built to form a straight line segment. Cells number i and i+1 are adjacent, and prisoners in adjacent cells...
2019-07-19 15:14:33
230
原创 POJ 1182食物链————并查集复习
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 105782 Accepted: 32027Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种...
2019-07-19 09:37:47
203
原创 HDU 3836Equivalent Sets——————Kosaraju求强连通分量
Equivalent SetsProblem DescriptionTo prove two sets A and B are equivalent, we can first prove A is a subset of B, and then prove B is a subset of A, so finally we got that these two sets are equiva...
2019-05-15 20:45:42
221
原创 HDU 2767 Proving Equivalences——————Kosaraju求强连通分量
Proving EquivalencesProblem DescriptionConsider the following exercise, found in a generic linear algebra textbook.Let A be an n × n matrix. Prove that the following statements are equivalent:A i...
2019-05-15 18:32:16
213
原创 HDU 1827 Summer Holiday——————(Kosaraju求强连通分量,缩点)
Summer HolidayTime Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4954 Accepted Submission(s): 2207Problem DescriptionTo see a World in a Gr...
2019-05-14 19:00:28
227
原创 POJ 2186 Popular Cows——————(Kosaraju求强连通分量,缩点)
Popular CowsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 42216 Accepted: 17135DescriptionEvery cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N &...
2019-05-14 18:57:20
266
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人