自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 收藏
  • 关注

原创 HDU6621 K-th Closest Distance(主席树)

K-th Closest DistanceTime Limit: 20000/15000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 444 Accepted Submission(s): 157Problem DescriptionYou have an ar...

2019-07-31 19:35:17 213

原创 线段树(模板)

#include<iostream>#include<vector>#include<cstdio>#include<cmath>using namespace std;typedef long long ll;int n,p,a,b,m,x,y,ans;struct node{ int l,r,w,f;} tree[400...

2019-07-31 10:38:40 103

原创 煤气灶(二分查找)

链接:https://ac.nowcoder.com/acm/problem/21860来源:牛客网小j开始打工,准备赚钱买煤气灶。第一天,小j的工资为n元,之后每天他的工资都比前一天多d元。已知煤气灶需要m元,求小j最少工作几天才能买到煤气灶。输入描述:四个整数 n,m,d,x分别表示小j第一天的工资,煤气灶的价格,工资每天的增长量,答案不超过x输出描述:一个数表示答案示例1...

2019-07-29 11:16:44 112

原创 牛客竞赛 最长回文(马拉车)

链接:https://ac.nowcoder.com/acm/problem/14894?tdsourcetag=s_pcqq_aiomsg来源:牛客网题目描述有两个长度均为n的字符串A和B。可以从A中选一个可以为空的子串A[l1…r1],B中选一个可以为空的子串B[l2…r2],满足r1=l2,然后把它们拼起来(A[l1…r1]+B[l2…r2])。求用这样的方法能得到的最长回文串的长度。...

2019-07-28 15:50:22 497

原创 计蒜客 I小灰灰的笼外领地(计算多边形面积)

小灰灰的笼外领地【题目描述】小灰灰在某天吃饱喝足后爬出了自己的笼子出来做运动。小灰灰作为实验室的明星鼠,大家当然不能让它去一些危险的地方,因此春阳哥就在小灰灰笼前的平地上按照顺时针顺序点了几个点,并用线将其顺时针连接了起来。酱,小灰灰就拥有了一个属于自己的安全的“笼外领地”啦!小灰灰在领地中逛久了自然感觉无趣,因此,它想要做一些有挑战的事情——写个程序算出来它的领地究竟有多大!然而,小灰灰实...

2019-07-27 19:29:15 283 1

原创 牛客竞赛 Youhane Assembler

链接:https://ac.nowcoder.com/acm/problem/15489来源:牛客网Youhane Assembler在生物信息学领域,一个非常有趣而重要的问题就是序列拼接(Sequence Assembly),而从头开始的序列拼接(de novo Assembly)尤为重要,因为很多时候我们并不能使用参考用的序列信息(比如当我们对全新的物种进行测序,或者我们必须不能依赖参...

2019-07-27 16:24:20 266

原创 牛客竞赛 字符串的问题

链接:https://ac.nowcoder.com/acm/problem/15165来源:牛客网题目描述有一个字符串 让你找到这个字符串 S 里面的子串T 这个子串 T 必须满足即使这个串的前缀 也是这个串的后缀 并且 在字符串中也出现过一次的(提示 要求满足前后缀的同时也要在字符串中出现一次 只是前后缀可不行 输出最长满足要求字符串)输入描述:给出一个字符串 长度 1 到 1e6...

2019-07-27 14:05:48 837

原创 平衡二叉树

#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;#define inf 0x3f3f3f3fstruct node{ int v; node *left,*right;};node *...

2019-07-25 20:42:08 95

原创 KMP和扩展kmp

转载:https://blog.csdn.net/v_july_v/article/details/7041827#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int N=100;int next[100];void GetNextva...

2019-07-25 20:37:53 115

转载 Trie树(字典树,单词查找树)

转载:https://blog.csdn.net/forever_dreams/article/details/81009580 原 Trie树(字典树,单词查找树) ...

2019-07-25 11:17:16 121

转载 马拉车算法

转载:https://blog.csdn.net/happyrocking/article/details/82622881#include<cstdio>#include<cstring>#include<algorithm>using namespace std;/* p【i】:代表以i为中点的回文串长度。mx:当前回文串的最右端点的位置。...

2019-07-24 20:21:27 129

原创 Just Skip The Problem

Just Skip The ProblemProblem DescriptionY_UME has just found a number x in his right pocket. The number is a non-negative integer ranging from 0 to 2n−1 inclusively. You want to know the exact value...

2019-07-24 16:29:55 305

原创 Keen On Everything But Triangle(主席树)

Keen On Everything But TriangleProblem DescriptionN sticks are arranged in a row, and their lengths are a1,a2,…,aN.There are Q querys. For i-th of them, you can only use sticks between li-th to ri-...

2019-07-24 16:25:48 156

原创 580A A. Kefa and First Steps

A. Kefa and First StepsDescriptionKefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress,...

2019-07-23 21:42:12 161

原创 1197 A A. DIY Wooden Ladder

A. DIY Wooden LadderLet’s denote a k-step ladder as the following structure: exactly k+2 wooden planks, of whichtwo planks of length at least k+1 — the base of the ladder;k planks of length at leas...

2019-07-23 20:45:33 161

原创 邻接表Dijkstra(求最短路径)

板子板子,学长给的#include<bits/stdc++.h>using namespace std;const int N=1100;const int inf=0x3f3f3f3f;bool vis[N];int dis[N];int n;vector<pair<int,int> >mp[N];struct node{ int ...

2019-07-23 18:25:13 1211

转载 最大流最小割

转载:https://blog.csdn.net/qq_41357771/article/details/79416899Dinic#include<cstdio>#include<cstring>#include<iostream>#define MAXN 10005#define MAXE 200005using namespace std;...

2019-07-23 16:22:28 71

原创 用vector建立邻接表(图)

有向无权图#include <iostream>#include <vector>#include <cstdlib>#define MAX 10000using namespace std;vector<int> p[MAX];int main(){ int n, m; cin >> n >>...

2019-07-23 13:49:27 2387 3

转载 优先队列用法

#include<bits/stdc++.h>typedef long long ll;using namespace std;const int maxn=2e5+5;struct DR{ int id; double nt; bool operator > (const DR &Vt)const{ return nt>Vt.n...

2019-07-22 18:21:31 76

原创 Rng(逆元)

RngProblem DescriptionAvin is studying how to synthesize data. Given an integer n, he constructs an interval using the following method: he first generates a integer r between 1 and n (both inclusiv...

2019-07-22 10:04:00 244

原创 逆元

逆元当求解公式:(a/b)%m 时,因b可能会过大,会出现爆精度的情况,所以需变除法为乘法:设c是b的逆元,则有b*c≡1(mod m);则(a/b)%m = (a/b)1%m = (a/b)bc%m = ac(mod m);即a/b的模等于a*b的逆元的模;最后就得出x^(p-2)为x的逆元啦。#include<iostream>#include<vector&g...

2019-07-22 09:58:01 107

原创 wave(dp题)

WaveProblem DescriptionAvin is studying series. A series is called “wave” if the following conditions are satisfied:It contains at least two elements;All elements at odd positions are the same;A...

2019-07-21 21:32:54 265

原创 2019CCPC-江西省赛(重现赛)- 感谢南昌大学

StringProblem DescriptionAvin has a string. He would like to uniform-randomly select four characters (selecting the same character is allowed) from it. You are asked to calculate the probability of ...

2019-07-21 19:45:57 772

原创 Checkout

CheckoutProblem DescriptionAlice 是一个身怀改变世界的抱负的著名企业家,手中掌控很多著名的公司,为了更好的管理, Alice 建立了一套很完善的架构体系,已知 Alice 的企业的架构体系是一棵树,每个节点代表一个人。对于每个节点,它的父节点就是这个人的直接 leader,每个节点都有一个权值,代表这个人的爱好,每对属于同 一直接 leader 的节点如果有相同...

2019-07-21 10:40:24 187

原创 PAT 甲级1014 Waiting in Line (30 分)

1014 Waiting in Line (30 分)Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to ...

2019-07-19 14:23:23 128

原创 Valeriy and Deque(双向队列)

Valeriy and DequeRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with nn elements. The ii-th element is aiai (ii = 1,2,…,n1,2,…,...

2019-07-19 10:47:44 125

原创 PAT甲级 1013 Battle Over Cities (25 分)

1013 Battle Over Cities (25 分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We ...

2019-07-19 09:52:22 86

原创 PAT-甲级1012

1012 The Best Rank (25 分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Li...

2019-07-19 09:29:37 85

原创 ZCMU暑期训练四

A - Vus the Cossack and a ContestVus the Cossack holds a programming competition, in which nn people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactl...

2019-07-18 15:44:38 448

原创 2018CCPC吉林赛区(重现赛)- 感谢北华大学 部分题解

A The FoolTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1346 Accepted Submission(s): 535Problem DescriptionThe Fool is numbered 0 – ...

2019-07-17 21:26:28 953

原创 HDU 6546

FunctionProblem Descriptionwls 有 n 个二次函数 Fi(x) = aix2 + bix + ci (1 ≤ i ≤ n).现在他想在∑ni=1xi = m 且 x 为正整数的条件下求∑ni=1Fi(xi)的最小值。请求出这个最小值。Input第一行两个正整数 n, m。下面 n 行,每行三个整数 a, b, c 分别代表二次函数的二次项, 一次项,常数...

2019-07-16 09:53:07 385

原创 2019中国大学生程序设计竞赛-女生专场(重现赛)

TicketTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 674 Accepted Submission(s): 373Problem Description北京地铁票每月的打折规则为:本次乘车前总消费不足 100 元本...

2019-07-15 17:05:18 1317 2

原创 动态数组建树

TreeProblem Descriptionwls 有三棵树,树上每个节点都有一个值 ai,现在有 2 种操作:将一条链上的所有节点的值开根号向下取整;求一条链上值的和;链的定义是两点之间的最短路。Input第一行两个数 n, q 分别代表树上点的数量和操作数量。第二行 n 个整数,第 i 个数代表第 i 个点的值 ai。接下来 n − 1 行, 每行两个整数 u, v 代...

2019-07-15 10:23:50 306

原创 暑假集训

1010 Hazard and The TriangleI’m Eden Hazard,the so-called “superb passer”. In a match in the group stage,three players surrounding me tried to block my advance,which,of course,failed. However,at that...

2019-07-12 13:43:10 402

原创 PAT甲级-1011

1011 World Cup Betting (20 分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World ...

2019-07-10 17:13:07 75

转载 PAT甲级-1010

1010 Radix (25 分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pair...

2019-07-09 16:22:50 77

转载 Secret Poems

Secret PoemsThe Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He was a very hard-working ruler. He cracked down on corruption and his reig...

2019-07-09 16:09:44 161

原创 Cats and Fish

Cats and FishThere are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei is one of the members of the cat club. He loves ...

2019-07-09 16:01:12 225

空空如也

空空如也

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

TA关注的人

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