- 博客(119)
- 资源 (1)
- 收藏
- 关注
原创 【跨立实验】poj2653
Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there is no ...
2019-08-14 21:59:24
503
转载 【跨立实验-非严格相交】poj1556
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 points of ...
2019-08-14 20:13:27
224
原创 【计算几何】POJ - 1269
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) intersect...
2019-08-12 22:53:16
110
原创 【2019牛客多校第六场D Move】【二分】
链接:https://ac.nowcoder.com/acm/contest/886/D来源:牛客网题目描述After the struggle of graduating from college, TangTang is about to move from a student apartment to his new home.TangTang has n items to ...
2019-08-04 16:44:53
389
原创 【Manacher】HDU4513 求前缀递增后缀递减的回文字符串
吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,第2个人和第m-1个...
2019-08-02 16:33:56
133
原创 【Manacher】HDU3294 查找字符串中回文的起始位置和结束位置
One day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps:First step: girls will write a long string (only contains lower case) ...
2019-08-02 16:08:07
239
转载 【字符串函数应用】HDU - 4847
Wow! Such Doge!Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4424Accepted Submission(s): 2570Problem DescriptionChen, Adrian (N...
2019-08-01 10:09:37
185
原创 【Manacher】HDU - 3068
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度len <= 110000Output每一行一个整数x,对应一组...
2019-08-01 10:04:43
116
原创 【最小最大表示】HDU - 2609
Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell meHow many kinds of necklaces total have.(if two necklaces can equal by rotating ,we say the two necklaces a...
2019-08-01 09:44:53
103
转载 【字符串的最小最大表示】HDU - 2609
Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell meHow many kinds of necklaces total have.(if two necklaces can equal by rotating ,we say the two necklaces a...
2019-08-01 09:29:09
146
原创 【扩展KMP】Clairewd’s message
Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that each letter of these mes...
2019-07-31 21:01:40
228
原创 【Next数组的花式用法】HDU3336
It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example:s: "abab...
2019-07-30 11:09:25
199
原创 【KMP】Power Strings 循环节应用
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 concatenation as multiplication, exponentiation by a non-...
2019-07-24 23:33:24
124
原创 【KMP】Period
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ...
2019-07-24 23:14:15
169
原创 【扩展欧几里得】C Looooops
A Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and wh...
2019-07-24 21:32:42
180
原创 【扩展欧几里得】青蛙的约会
两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,...
2019-07-23 23:36:37
169
原创 扩展欧几里得定理
这样的话可以利用递归的思想算出来#include<iostream>#include<cstdio>#include<cmath> using namespace std; int exgcd(int a,int b,int &x,int &y)//扩展欧几里得算法{ if(b==0) { ...
2019-07-23 21:57:43
208
原创 【精度控制+log应用】Candy
CandyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3072Accepted Submission(s): 1418Special JudgeProblem DescriptionLazyChild is a...
2019-07-23 11:28:24
165
转载 【精度问题】Prime Time
题目:https://vjudge.net/contest/70017#problem/W大佬博客:https://blog.csdn.net/iroy33/article/details/83211685精度上不去就加一个eps,应该是c++默认同步到最高位小数但是eps不能为1e-16这样的#include<cstdio>const int maxm = 1e4...
2019-07-22 21:25:47
282
原创 【欧拉函数】GCD - Extreme (II)
题目https://vjudge.net/contest/70017#problem/O题目大意:给定m,求m内中任意两个数i和j的gcd之和大佬题解:https://blog.csdn.net/duan_1998/article/details/71465256题解就是根据互质的两个数,枚举出所有的可能性比如gcd(2,3)=1,那么gcd(4,6)=2,gcd(6,9)=3...
2019-07-21 21:15:57
231
原创 【素数筛+区间枚举】Help Hanzo
Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo Hattori, the best ninja and the love of Nakururu. After he...
2019-07-20 16:45:03
158
原创 【找规律】Fantasy of a Summation
If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.#include <stdio.h>intcases,c...
2019-07-20 15:51:00
127
原创 【唯一分解定理】Mysterious Bacteria
Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactlyxdays. Now RC-01 produces exactlypnew deadly Bacteria wherex = ...
2019-07-20 15:11:41
265
原创 【唯一分解定理】Pairs Forming LCM
Find the result of the following code:longlongpairsFormLCM(intn){ longlongres=0; for(inti=1;i<=n;i++) for(intj=i;j<=n;j++) if( lcm(i,j) ...
2019-07-20 14:21:43
226
原创 【找规律】Harmonic Number (II)
I was trying to solve problem'1234 - Harmonic Number', I wrote the following codelonglongH(intn){ longlongres=0; for(inti=1;i<=n;i++) res=res+n/i; ret...
2019-07-19 18:41:19
181
原创 【快速幂思想求多次幂的前几位数】Leading and Trailing
You are given two integers:nandk, your task is to find the most significant three digits, and least significant three digits ofnk.InputInput starts with an integerT (≤ 1000), denoting the num...
2019-07-18 21:37:47
252
原创 【唯一分解定理】Aladdin and the Flying Carpet
It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magi...
2019-07-18 09:05:00
197
原创 【poj3304】计算几何 线段与直线的投影
SegmentsTime Limit:1000MS Memory Limit:65536K Total Submissions:19350 Accepted:6082 DescriptionGivennsegments in the two dimensional space, write a program, which determi...
2019-06-04 11:02:12
2467
转载 【multiset】Glass Carving
Glass Carvingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeonid wants to become a glass carver (the person who creates be...
2019-05-27 20:59:06
189
原创 【CH2101】可达性统计 拓补+二进制存储
2101 可达性统计0x20「搜索」例题描述给定一张N个点M条边的有向无环图,分别统计从每个点出发能够到达的点的数量。N,M≤30000。输入格式第一行两个整数N,M,接下来M行每行两个整数x,y,表示从x到y的一条有向边。输出格式共N行,表示每个点能够到达的点的数量。样例输入10 103 82 32 55 95 92 33 94 82 10...
2019-05-21 20:08:52
220
原创 【HDU4857】逃生 拓补排序
逃生Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9374Accepted Submission(s): 2659Problem Description糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大...
2019-05-21 18:52:54
151
原创 【poj1190】生日蛋糕 搜索剪枝 公式推导最小面积
生日蛋糕Time Limit:1000MS Memory Limit:10000K Total Submissions:25000 Accepted:8945 Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i(1 <= i <= M)层...
2019-05-21 11:50:53
287
原创 【计蒜客】引爆炸弹 【并查集】
在一个n \times mn×m的方格地图上,某些方格上放置着炸弹。手动引爆一个炸弹以后,炸弹会把炸弹所在的行和列上的所有炸弹引爆,被引爆的炸弹又能引爆其他炸弹,这样连锁下去。现在为了引爆地图上的所有炸弹,需要手动引爆其中一些炸弹,为了把危险程度降到最低,请算出最少手动引爆多少个炸弹可以把地图上的所有炸弹引爆。输入格式第一行输两个整数n,mn,m,用空格隔开。接下来nn...
2019-05-18 20:35:38
658
原创 【LIS】合唱队形
题目描述NN位同学站成一排,音乐老师要请其中的(N-KN−K)位同学出列,使得剩下的KK位同学排成合唱队形。合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2,…,K1,2,…,K,他们的身高分别为T_1,T_2,…,T_KT1,T2,…,TK, 则他们的身高满足T_1<...<T_i>T_{i+1}>…>T_K(1 \le i \le K)...
2019-05-02 20:49:54
356
原创 【HDU5592】【权值线段树】根据逆序对求原数组
ZYB's PremutationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1285Accepted Submission(s): 677Problem DescriptionZYBhas a prem...
2019-03-29 14:50:04
290
原创 POJ3579 Median【二分寻找差值】
题意:有n个数组成的一个序列,对于∣Xi-Xj∣(1≤i<j≤N),这样的数总共C(N,2)个,求出值处在最中间的那个数先将序列排成有序,之后二分之间的差值。比如1,2,5,8,9,12假设现在二分中当前mid=2。对于1来说,a[i]-a[1]>=mid的有5,8,9,12对于2来说,a[i]-a[2]>=mid的有5,8,9,12对于5来说,...
2019-03-21 10:22:53
310
原创 【01背包】HDU2602 Bone Collector
Bone CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 93021 Accepted Submission(s): 38039 Problem DescriptionMany years ago ,...
2019-02-22 10:55:29
122
原创 【01背包】HDU1171 Big Event in HDU
Big Event in HDUTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 54587 Accepted Submission(s): 18481 Problem DescriptionNowadays, we ...
2019-02-22 10:46:24
81
原创 【01背包】HDU2546饭卡
饭卡Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 46676 Accepted Submission(s): 15905 Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判...
2019-02-22 10:16:53
168
原创 DP与朴素算法差异 【CF】Writing Code
Writing Codetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputProgrammers working on a large project have just received a task to ...
2019-02-21 17:12:26
228
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅