简单算法
DlPF_C
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU 5933 ArcSoft's Office Rearrangement 贪心
题目链接:https://vjudge.net/problem/HDU-5933题解:因为拆分合并只需要考虑相邻的区域就好,所以不够就合并,多了就拆分。#include#define maxn 100010#define ll long longusing namespace std;int main(){ int T; scanf("%d",&T); i原创 2017-10-22 19:08:08 · 388 阅读 · 0 评论 -
CodeForces - 701C They Are Everywhere
C. They Are Everywheretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSergei B., the young coach of Pokemo原创 2017-07-28 16:41:57 · 401 阅读 · 0 评论 -
CodeForces - 455A Boredom
A. Boredomtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex doesn't like boredom. That's why whenever he原创 2017-07-28 17:07:06 · 564 阅读 · 0 评论 -
51Nod - 1089 最长回文子串 V2(Manacher算法)
1089 最长回文子串 V2(Manacher算法)基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题回文串是指aba、abba、cccbccc、aaaa这种左右对称的字符串。输入一个字符串Str,输出Str里最长回文子串的长度。Input输入Str(Str的长度 Output输出最长回文原创 2017-07-28 19:21:58 · 291 阅读 · 0 评论 -
CodeForces - 678D Iterated Linear Function
D. Iterated Linear Functiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider a linear function f(x)原创 2017-07-28 17:28:06 · 483 阅读 · 0 评论 -
CodeForces - 276C Little Girl and Maximum Sum
C. Little Girl and Maximum Sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe little girl loves the pr原创 2017-07-28 19:56:41 · 603 阅读 · 0 评论 -
CodeForces - 276B Little Girl and Game
B. Little Girl and Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Little Girl loves problems on g原创 2017-07-28 20:09:46 · 1651 阅读 · 0 评论 -
CodeForces - 96B
Lucky Numbers (easy)搜索,因为数字只有4和7,所以搜索量不大,思路简单,但不好想,看代码。#includelong long n,s;void search(long long a,int x,int y)//x表示4的数量,y表示7的数量{ if(a>=n&&x==y&&(a<s||!s)) s=a; if(a<n*100) {原创 2017-08-14 20:34:30 · 366 阅读 · 0 评论 -
CodeForces - 53D Physical Education
D. Physical Educationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is a school PE teacher. Unlike原创 2017-08-14 20:48:39 · 581 阅读 · 0 评论 -
CodeForces - 793B Igor and his way to work dfs搜索
B. Igor and his way to worktime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWoken up by the alarm clock Igo原创 2017-08-25 11:31:05 · 445 阅读 · 0 评论 -
UVA - 10285 Longest Run on a Snowboard
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1226DFS+记忆化搜索#include#define N 105#define INF 200int maps[N][N];int ans[N][N];int dfs(int原创 2017-08-25 14:27:39 · 434 阅读 · 0 评论 -
POJ1753 Flip Game 位运算+搜索
Flip GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 46458 Accepted: 19890DescriptionFlip game is played on a rectangular 4x4 field with two-sided原创 2017-08-23 15:59:12 · 388 阅读 · 0 评论 -
HDU 6158 The Designer 笛卡尔定理+韦达定理 2017ccpc网络赛
The DesignerTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1198 Accepted Submission(s): 233Problem DescriptionNowadays, litt原创 2017-08-23 16:29:01 · 655 阅读 · 0 评论 -
Coin 2017ICPC西安网络赛
原题链接:https://nanti.jisuanke.com/t/17115Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face up is \frac{q}{p}(\frac{q}{p} \le \frac{1}{2})pq(p原创 2017-09-16 20:03:15 · 604 阅读 · 0 评论 -
CodeForces - 808C C. Tea Party (贪心)
C. Tea Partytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp invited all his friends to the tea par原创 2017-09-09 20:09:56 · 474 阅读 · 0 评论 -
Code Force 825D Suitable Replacement
D. Suitable Replacementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings s and t co原创 2017-09-09 20:20:05 · 450 阅读 · 0 评论 -
CodeForces - 825E CodeForces - 825E
E. Minimal Labelstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a directed acyclic graph wit原创 2017-08-04 21:29:17 · 709 阅读 · 0 评论 -
HDU 5938 Four Operations 模拟
题目链接:https://vjudge.net/problem/HDU-5938题意:输入一个字符串,从左到右依次插入+-×/,求所得的算式的最大值。题解:算式一定是a+b-c*d/e的形式,c和d只分配一个数,a+b最大的情况只有两种,然后从前向后枚举e的值。#includeusing namespace std;#define ll long longchar s[25];原创 2017-10-22 19:21:17 · 394 阅读 · 0 评论 -
HDU 5245 期望概率
JoyfulTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1610 Accepted Submission(s): 707Problem DescriptionSakura has a very ma原创 2017-11-17 20:34:02 · 390 阅读 · 0 评论 -
CodeForce Round 446 Pride
Pridetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have an array a with length n, you can perform原创 2017-11-18 12:54:16 · 383 阅读 · 0 评论 -
Uva10047 The Monocycle
原题链接:https://vjudge.net/problem/UVA-10047绞尽脑汁的图论题,虽然只是bfs但是要求到达的最小时间以及符合到达终点的条件还是需要思考一番。用优先队列保证到达时间最小,每一个方块的访问方式由进入的方向以及轮子的颜色划分。#include#define INF 0x3f3f3f3fusing namespace std;int n,m;int原创 2018-01-30 17:32:52 · 420 阅读 · 0 评论 -
Uva -11624 Fire!
原题链接:https://vjudge.net/problem/UVA-11624双入口同时BFS#include#define INF 10001010using namespace std;char M[1010][1010];int T[1010][1010];bool judgej[1010][1010];bool judgef[1010][1010];int n原创 2018-01-30 17:37:16 · 348 阅读 · 0 评论 -
常见的3种博弈总结
巴什博弈典型问题:一堆只有n个物品,两人轮流从堆中取,最少一个,最多m个,最后取光者胜。如果n=m+1。后手胜。取胜法则n=(m+1)*r+s。其中r为任意自然数,s尼姆博弈典型问题:有n堆若干物品,两人轮流从某一堆取任意多物品,规定每次至少取一个,多者不限,最后取光者胜。以三堆为例,我们用(a,b,c)表示某种局势,首先(0,0,0)显然是必败态。第二 种必败态是(0原创 2017-08-07 17:39:45 · 1065 阅读 · 0 评论 -
HDU 1556 Color the ball
Color the ballTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24404 Accepted Submission(s): 11853Problem DescriptionN个气球排成一排,原创 2018-01-24 10:58:43 · 337 阅读 · 0 评论 -
最长上升子序列nlogn的求法
假设存在一个序列d[1..9] = 2 1 5 3 6 4 8 9 7,可以看出来它的LIS长度为5。n下面一步一步试着找出它。我们定义一个序列B,然后令 i = 1 to 9 逐个考察这个序列。此外,我们用一个变量Len来记录现在最长算到多少了首先,把d[1]有序地放到B里,令B[1] = 2,就是说当只有1一个数字2的时候,长度为1的LIS的最小末尾是2。这时Len=1转载 2018-01-20 20:12:12 · 765 阅读 · 0 评论 -
POJ 1190生日蛋糕
生日蛋糕Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21221 Accepted: 7546Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 R原创 2018-01-29 17:42:51 · 434 阅读 · 0 评论 -
51Nod 1119 机器人走方格 组合数模板
机器人走方格V2M*N的方格,一个机器人从左上走到右下,只能向右走或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出MOD^9+7的结果。第一行,2个数M,N中间用空格隔开。(21000000)输出走法数量Mod 10^9+7#include#define ll long long#define maxn 2000010 #define mod 100000000原创 2018-01-29 19:08:02 · 308 阅读 · 0 评论 -
CodeForces - 96D Volleyball 最短路
D. Volleyballtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya loves volleyball very much. One day he原创 2018-01-29 19:33:37 · 709 阅读 · 0 评论 -
HDU 2586 How far a way
勇气小镇是一个有着n个房屋的小镇,为什么把它叫做勇气小镇呢,这个故事就要从勇气小镇成立的那天说起了,修建小镇的时候,为了让小镇有特色,镇长特地只修了n-1条路,并且规定说,所有在勇气小镇的村民,每一次出门必须规划好路线, 路线必须满足在到达终点之前绝对不走回头路。每个人都要这样,不然那个人就不配在小镇生活下去,因为他没有这个勇气。事实上,这并不能算一项挑战,因为n-1条路已经连通了每户原创 2018-01-29 19:47:50 · 472 阅读 · 0 评论 -
2018 华中科技校赛 K Walking in the Forest 最大化最小值
链接:https://www.nowcoder.com/acm/contest/106/K来源:牛客网题目描述 It’s universally acknowledged that there’re innumerable trees in the campus of HUST.Now you're going to walk through a large forest. There is a ...原创 2018-04-30 11:25:02 · 383 阅读 · 0 评论 -
HDU 5929 Basic Data Structure 双向队列
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw the elemen...原创 2018-07-19 10:16:55 · 325 阅读 · 0 评论 -
HihoCoder - 1514 偶像的条件
#1514 : 偶像的条件时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi的学校正面临着废校的大危机。面对学校的危机,小Hi同学们决定从ABC三个班中各挑出一名同学成为偶像。 成为偶像团体的条件之一,就是3名团员之间的身高差越小越好。 已知ABC三个班同学的身高分别是A1..AN, B1..BM原创 2017-08-03 09:54:19 · 538 阅读 · 0 评论 -
简单贪心
今年暑假不ACTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 56207 Accepted Submission(s): 30227Problem Description“今年暑假不AC?”“是的。原创 2017-04-19 20:17:39 · 361 阅读 · 0 评论 -
并查集模板
How Many Tables #includeint per[1001];int find(int x){ int r=x; while(r!=per[r]) r=per[r]; int i=x,j; while(i!=r) { j=per[i]; per[i]=r;原创 2017-04-21 17:19:39 · 382 阅读 · 0 评论 -
最小生成树Prim算法模板
畅通工程 #include#define maxn 101#define INF 0x7fffffffint cost[maxn][maxn];int mincost[maxn];bool used[maxn];int n,m;int Min(int a,int b){ return a<b?a:b;}void prim(){ fo原创 2017-05-05 11:04:10 · 496 阅读 · 0 评论 -
Dijkstra算法模板
最短路Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 63266 Accepted Submission(s): 27701Problem Description在每年的校赛里,所有进入决赛的同学都会获原创 2017-04-23 20:14:45 · 388 阅读 · 0 评论 -
KMP算法next求法
定义:(1)next[0]= -1 意义:任何串的第一个字符的模式值规定为-1。(2)next[j]= -1 意义:模式串T中下标为j的字符,如果与首字符相同,且j的前面的1—k个字符与开头的1—k个字符不等(或者相等但T[k]==T[j])(1≤k)。如:T=”abCabCad” 则 next[6]=-1,因T[3]=T[6](3)next[j]=k 意义:模转载 2017-04-25 17:19:11 · 923 阅读 · 0 评论 -
KMP算法next的变形
设字符串S长度为L此时next表示S的字串T,长度为P的next【P】的值。 void get_valnext(char s[maxn]){ int j=0,k=-1; next[0]=k; while(s[j]!='\0') { if(s[j]==s[k]||k==-1) { ++j;原创 2017-04-25 21:18:59 · 427 阅读 · 0 评论 -
最长上升子序列
原文章地址:https://xuanwo.org/2015/07/31/dp-lis/。动态规划——最长上升子序列问题介绍最长上升子序列问题,也就是Longest increasing subsequence,缩写为LIS。是指在一个序列中求长度最长的一个上升子序列的问题,是动态规划中一个相当经典问题。在这里我们可以看到,这个上升实质上就是一个对进行定义的过程,所以转载 2017-05-21 12:53:23 · 365 阅读 · 0 评论 -
HDU-1811 Rank of Tetris(拓扑排序)
Rank of TetrisTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9697 Accepted Submission(s): 2798Problem Description自从Lele开发了Ra原创 2017-07-14 14:33:55 · 320 阅读 · 0 评论
分享