- 博客(84)
- 收藏
- 关注
转载 Manacher's Algorithm 马拉车算法
转载自https://www.cnblogs.com/grandyang/p/4475985.html这个马拉车算法Manacher‘s Algorithm是用来查找一个字符串的最长回文子串的线性方法,由一个叫Manacher的人在1975年发明的,这个方法的最大贡献是在于将时间复杂度提升到了线性,这是非常了不起的。对于回文串想必大家都不陌生,就是正读反读都一样的字符串,比如 "bob...
2019-03-11 23:08:50
185
原创 2018程设模考2
A分别记录纸币剩余数量判断是否能找零,因为数据比较弱所以对于5+5+5的情况没考虑也过了。#include<bits/stdc++.h>using namespace std;int main(){ int a=0,b=0,c=0; int n; int flag=1; while(scanf("%d",&n)!=EOF) ...
2018-12-21 16:18:57
659
原创 POJ 1837 Balance(分组背包)
BalanceTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 16611 Accepted: 10433 DescriptionGigel has a strange "balance" and he wants to poise it. Actually, the device ...
2018-09-21 16:13:39
232
原创 HDU 3033 I love sneakers!(分组背包)
I love sneakers!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6928 Accepted Submission(s): 2825 Problem DescriptionAfter months of ...
2018-09-21 15:21:19
181
原创 SWERC2017 E.Ingredients(拓扑排序+01背包)
因为一个披萨得由另外的披萨加料制成,所以有一个先后顺序问题,用拓扑排序跑一遍,找出n种披萨的最优情况后背包即可。#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e6+5;const int inf=0x3f3f3f3f;int dp[maxn],deg[max...
2018-09-21 14:18:42
297
原创 ZOJ 3662 Math Magic
Math Magic Time Limit: 3 Seconds Memory Limit: 32768 KB Yesterday, my teacher taught us about math: +, -, *, /, GCD, LCM... As you know, LCM (Least common multiple) of two positive ...
2018-09-16 22:27:18
189
原创 ZOJ 3623 Battle Ships
Battle Ships Time Limit: 2 Seconds Memory Limit: 65536 KB Battle Ships is a new game which is similar to Star Craft. In this game, the enemy builds a defense tower, which has L long...
2018-09-16 22:19:50
138
原创 POJ 2063 Investment
InvestmentTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 12098 Accepted: 4207 DescriptionJohn never knew he had a grand-uncle, until he received the notary's letter...
2018-09-16 22:13:42
94
原创 POJ 1787 Charlie's Change(完全背包+物品计数+记录路径)
Charlie's ChangeTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 5108 Accepted: 1620 DescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a ...
2018-09-16 22:09:33
167
原创 ACM-ICPC 2018 焦作赛区网络预赛 B.Mathematical Curse
A prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some mathematical curses. He studied hard until he reached ...
2018-09-16 00:34:31
173
原创 ACM-ICPC 2018 焦作赛区网络预赛 K.Transport Ship(01背包)
There are NN different kinds of transport ships on the port. The i^{th}ith kind of ship can carry the weight of V[i]V[i] and the number of the i^{th}ith kind of ship is 2^{C[i]} - 12C[i]−1. How many d...
2018-09-16 00:28:19
505
原创 POJ 3181 Dollar Dayz(完全背包)
Dollar DayzTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 2275 Accepted: 934 DescriptionFarmer John goes to Dollar Days at The Cow Store and discovers an unlimited ...
2018-09-13 00:21:43
143
原创 HDU 2126 Buy the souvenirs(01背包)
Buy the souvenirs Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3228 Accepted Submission(s): 1247 Problem Description ...
2018-09-12 23:40:09
136
原创 UVA 674 Coin Change(完全背包)
UVA 674 Coin Change 解题报告题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87730#problem/E题目:Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want ...
2018-09-12 23:32:54
289
原创 2018 南京网络邀请赛 E. AC Challenge
Dlsj is competing in a contest with n (0 < n \le 20)n(0<n≤20) problems. And he knows the answer of all of these problems.However, he can submit ii-th problem if and only if he has submitted (a...
2018-09-12 21:59:15
157
原创 ZOJ 3469 Food Delivery(区间dp)
Food DeliveryTime Limit: 2 Seconds Memory Limit: 65536 KBWhen we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, ...
2018-09-05 22:46:46
126
原创 CF 149 D Coloring Brackets(区间dp)
D. Coloring Bracketstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce Petya read a problem about a bracket sequence. He gave ...
2018-09-04 20:55:36
144
原创 POJ 2955 Brackets(区间dp)
BracketsTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 12328 Accepted: 6538 DescriptionWe give the following inductive definition of a “regular brackets” sequence:...
2018-09-04 00:18:20
130
原创 HDU 1247 Hat’s Words(字典树)
Hat’s Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19043 Accepted Submission(s): 6722 Problem Description A h...
2018-08-24 19:46:19
111
原创 HDU 1671 Phone List(字典树)
Phone List Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 25761 Accepted Submission(s): 8610 Problem Description Give...
2018-08-24 18:13:57
114
原创 HDU 1075 What Are You Talking About(字典树)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 28557 Accepted Submission(s): 9730 Problem D...
2018-08-21 23:34:26
116
原创 HDU 1251 统计难题(字典树)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 56811 Accepted Submission(s): 19884 Problem Description Ignatius...
2018-08-21 16:21:40
94
原创 2018牛客多校第九场 E.Music Game
链接:https://www.nowcoder.com/acm/contest/147/E来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Niuniu likes to play OSU!We simplify the game OSU to the foll...
2018-08-18 16:27:45
235
原创 HDU 6390 GuGuFishtiion(欧拉函数+莫比乌斯反演)
GuGuFishtion Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1325 Accepted Submission(s): 516 Problem Description Today...
2018-08-18 00:40:52
238
原创 HDU 1695 GCD(莫比乌斯反演入门)
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15624 Accepted Submission(s): 6013 Problem Description Given 5 int...
2018-08-17 17:01:28
202
原创 HDU 6406 Taotao Picks Apples
Taotao Picks Apples Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1463 Accepted Submission(s): 454 Problem Description...
2018-08-17 00:10:18
119
原创 HDU 6395 Sequence(矩阵快速幂)
Sequence Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1407 Accepted Submission(s): 512 Problem Description Let us ...
2018-08-14 16:30:59
142
原创 2018牛客多校第五场 H、subseq(树状数组)
链接:https://www.nowcoder.com/acm/contest/143/H来源:牛客网 间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Kanade has an array a[1..n] , she define that an array b[1..m] i...
2018-08-08 00:27:01
240
原创 2018牛客多校第五场 I vcd(树状数组)
链接:https://www.nowcoder.com/acm/contest/143/I来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Kanade has an infinity set H contain all of sets such as {(x,y)...
2018-08-07 17:43:39
229
原创 2018牛客多校第五场 take (树状数组+期望)
链接:https://www.nowcoder.com/acm/contest/143/F来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Kanade has n boxes , the i-th box has p[i] probability to have ...
2018-08-06 23:34:13
263
原创 HDU 6333 Problem B. Harvest of Apples(莫队算法+组合数)
Problem B. Harvest of Apples Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 2671 Accepted Submission(s): 1045 Problem D...
2018-08-03 22:16:06
143
原创 BZOJ 2038 小Z的袜子(初识莫队算法)
2038: [2009国家集训队]小Z的袜子(hose)Time Limit: 20 Sec Memory Limit: 259 MBSubmit: 15618 Solved: 7090[Submit][Status][Discuss]Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜...
2018-08-03 00:07:04
138
原创 HDU 6341 Problem J. Let Sudoku Rotate
Problem J. Let Sudoku RotateTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 530 Accepted Submission(s): 146 Problem DescriptionSudo...
2018-08-02 21:48:42
215
原创 HDU 6319 Problem A. Ascending Rating(单调队列)
Problem A. Ascending Rating Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 3776 Accepted Submission(s): 1246 Problem D...
2018-07-31 22:19:18
111
原创 POJ 2481 Cows(树状数组)
题目链接:http://poj.org/problem?id=2481题意:每头牛吃草都有一个区间[l,r],如果一头牛的吃草区间在另一头牛吃草区间中,并且区间不能完全一样。则另一头牛就更加健壮。现在给你n头牛的吃草区间,问你对于每一头牛来说,有多少头牛比它健壮。思路:根据题意我们首先根据右端点从大到小排序,如果右端点相同则根据左端点从小到大排序,这样只需要比对左端点大小,排序完成之后,对...
2018-07-29 23:34:43
102
原创 POJ 1195 Mobile phones(二维树状数组)
Mobile phonesDescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix wit...
2018-07-29 22:16:14
265
原创 POJ 2352 Stars(树状数组)
StarsTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 53403 Accepted: 22978 DescriptionAstronomers often examine star maps where stars are represented by points on a ...
2018-07-29 18:59:48
176
原创 POJ 2299 Ultra-QuickSort(树状数组)
题目链接:http://poj.org/problem?id=2299求逆序数,可以用归并排序求,这里用树状数组。因为数字最大可以达到999999999,开这么大的数组肯定是不现实的。所以要先把数据离散化处理。#include<cstdio>#include<cmath>#include<algorithm>#include<cstring...
2018-07-29 18:03:29
201
原创 HDU 1874 畅通工程续
畅通工程续Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 66513 Accepted Submission(s): 25730Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也...
2018-05-12 14:36:02
86
原创 HDU 2066 一个人的旅行
一个人的旅行Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 47568 Accepted Submission(s): 15786Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,...
2018-05-12 14:34:36
118
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人