- 博客(77)
- 收藏
- 关注
原创 51nod1347 旋转字符串 思维
旋转字符串 S0...n−10...n−1是一个长度为n的字符串,定义旋转函数Left(S)=S1…n−11…n−1+S00.比如S=”abcd”,Left(S)=”bcda”.一个串是对串当且仅当这个串长度为偶数,前半段和后半段一样。比如”abcabc”是对串,”aabbcc”则不是。现在问题是给定一个字符串,判断他是否可以由一个对串旋转任意次得到。 Input第1行:给...
2018-08-26 21:24:10 288
原创 zznuoj2024天空在下着雨,证明我水 打表
问题2024--天空在下着雨,证明我水2024: 天空在下着雨,证明我水时间限制: 1 Sec 内存限制: 128 MB提交: 296 解决: 57[提交] [状态] [讨论版] [命题人:admin]题目描述由算数基本定理可知:任何一个大于1的自然数 K,如果K不为质数,那么K可以唯一分解成有限个质数的乘积。若一个大于1的自然数,将其分解为质数乘积的形式后,分解所...
2018-08-25 17:08:00 131
原创 poj1742Coins 多重背包可行性
Coins总时间限制: 3000ms 内存限制: 65536kB描述People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some coin...
2018-08-25 16:37:41 134
原创 HPU暑期集训积分赛3
A题:Math ProblemDescription 求:\sum_{i=1}^n \lfloor \frac {a_i}{k} \rfloor∑i=1n⌊kai⌋ps: \lfloor x \rfloor⌊x⌋ 表示x向下取整Input 第一行一个整数TT表示测试组数。(1 \leq T \leq 10)(1≤T≤10)第二行一个nn和kk,nn表示序列a的...
2018-08-23 15:32:23 850
原创 poj3468 A Simple Problem with Integers 线段树区间更新
A Simple Problem with IntegersYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interv...
2018-08-22 22:25:37 104
原创 hdu1166 敌兵布阵 线段树
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 123436 Accepted Submission(s): 51707Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍...
2018-08-21 17:33:51 94
原创 hdu1754 I Hate It 线段树
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 102525 Accepted Submission(s): 38553Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问...
2018-08-21 16:42:00 100
原创 poj2456 Aggressive cows 二分
Aggressive cows 有一个神奇的盒子,它有N (2 <= N <= 1e5)个空间,这些空间依次编号为a1,...,aN (0 <= ai <= 1e9). 有x (2 <= x <= N)巧克力,如果多个巧克力放在一个空间就会爆炸。为了不让巧克力爆炸。我们需要使任意两个巧克力之间的最小距离尽可能的大,那么,这个最大的最小距离是什么呢?I...
2018-08-20 11:17:16 209
原创 codeforces895A Pizza Separation 思维
Pizza Separationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputStudents Vasya and Petya are studying at the BSU (Byteland State University)....
2018-08-19 22:41:14 156
原创 HPU暑期集训积分赛5
A题:时间限制 内存限制 出题人1 Second 512 Mb lzs题目描述有一个串S,定义任意串B的花费cost(B)为:需要添加几个字符可以让B的一个后缀串等于S.eg: S = ”abc”B = ”aaa”, cost(B) = 2, 需要添加两个字符0b0和0c0,B = ”aaabc”,使得B的一个后缀为S(”abc”)C = ”abc”, cost(C) =...
2018-08-19 20:07:38 226
原创 poj1200 Crazy Search 哈希hash
Crazy Search Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 33005 Accepted: 9063DescriptionMany people like to solve hard puzzles some of which may lead them to madne...
2018-08-19 11:05:05 137
原创 HDU4080 Stammering Aliens 二分+哈希
Stammering Aliens Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1939 Accepted Submission(s): 640Dr. Ellie Arroway has established con...
2018-08-19 10:34:45 500
原创 hdu3476Cyclic Nacklace KMP
Cyclic Nacklace CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and t...
2018-08-19 00:29:57 163
原创 poj2405 Power Strings 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, expone...
2018-08-18 23:48:39 138
原创 poj1961 && hdu1358 Period 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...
2018-08-18 23:44:36 121
原创 hdu2087 剪花布条 KMP
剪花布条 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 ...
2018-08-18 23:37:24 100
原创 poj3461 && hdu1686 Oulipo KMP && HASH哈希
Oulipo The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, m...
2018-08-18 23:33:26 159
原创 hdu1711 Number Sequence KMP
Number Sequence Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which ma...
2018-08-18 23:26:40 138
原创 牛客小白月赛6
B题:链接:https://www.nowcoder.com/acm/contest/136/B来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述 化而为鸟,其名为鹏。鹏之背,不知其几千里也。 ...
2018-08-18 23:08:33 334
原创 hdu1102 Constructing Roads Krustal最小生成树
Constructing Roads There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are conn...
2018-08-16 23:18:02 88
原创 poj1285 Agri-Net Prim最小生成树
Agri-Net Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Farmer John order...
2018-08-16 23:03:49 146
原创 hdu1875畅通工程再续 krustal最小生成树
畅通工程再续 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金...
2018-08-16 22:56:58 70
原创 poj1287 Networking Krustal最小生成树
NetworkingYou are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connec...
2018-08-16 22:50:46 143
原创 poj2485 Highways Prim
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're pla...
2018-08-16 22:45:53 98
原创 poj1988Cube Stacking 并查集
Cube StackingFarmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks Be...
2018-08-15 23:30:00 104
原创 hdu3047 Zjnu Stadium 并查集
Zjnu StadiumIn 12th Zhejiang College Students Games 2007, there was a new stadium built in Zhejiang Normal University. It was a modern stadium which could hold thousands of people. The audience Seat...
2018-08-15 23:28:14 121
原创 poj1611 The Suspects 并查集
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to s...
2018-08-15 23:24:45 86
原创 HDU3635 Dragon Balls 并查集
Dragon Balls Five hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gather all of the dragon balls together. His cou...
2018-08-15 15:30:58 121
原创 51nod2020 排序相减 水题
排序相减题目来源: syu练习题基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注“排序相减”操作是指对于任意一个四位数n,将四个数字分别进行顺序排序和逆序排序,得到两个数取相减后结果的绝对值n1,然后继续将n1中的四个数字进行顺序排序和逆序排序,得到两个数取相减后结果的绝对值n2,以此类推,最后总会得到一个数字黑洞,无法跳出。 ...
2018-08-15 00:18:19 108
原创 51nod1459 迷宫游戏 Dijkstra最短路
迷宫游戏 你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快离开迷宫...
2018-08-15 00:14:54 170
原创 poj3268 Silver Cow Party Dijkstra最短路
Silver Cow Party One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unid...
2018-08-14 23:07:56 102
原创 Lightoj1019 Brush (V) Dijkstra最短路
Brush (V) Tanvir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a brain storming programming contest? After checking a bit he found t...
2018-08-14 22:54:02 122
原创 poj2387 Til the Cows Come Home 最短路dijkstra
Til the Cows Come Home Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty s...
2018-08-14 22:50:53 93
原创 HDU1874 畅通工程续 最短路Dijkstra算法
畅通工程续 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(0<N&l...
2018-08-14 15:51:11 123
原创 HPU暑期积分赛4
E题:Description这个世界并不一定抽象。在某个大陆的某端,有一个异或王国,该国会评判一个人是否会使用异或(即位运算中的异或 XOR,对于两个数的二进制位,1 XOR 1 = 0, 0 XOR 0 = 0, 1 XOR 0 = 1,0 XOR 1 = 1)的能力,从而评判他是否是该国的人。Philo为了避免风险,只能强行去完成国王的异或测试。异或测试:一共有n个士兵棋子...
2018-08-13 18:15:00 420
原创 codeforces Round div3 D题 Polycarp and Div 3 思考
Polycarp and Div 3Polycarp likes numbers that are divisible by 3.He has a huge number ss. Polycarp wants to cut from it the maximum number of numbers that are divisible by 33. To do this, he makes...
2018-08-11 23:19:06 166
原创 51nod1084 矩阵取数问题V2 动态规划dp
矩阵取数问题 V2一个M*N矩阵中有不同的正整数,经过这个格子,就能获得相应价值的奖励,先从左上走到右下,再从右下走到左上。第1遍时只能向下和向右走,第2遍时只能向上和向左走。两次如果经过同一个格子,则该格子的奖励只计算一次,求能够获得的最大价值。 例如:3 * 3的方格。 1 3 32 1 32 2 1 能够获得的最大价值为:17。1 -> 3 -&g...
2018-08-11 23:09:26 145
原创 51nod1083 矩阵取数问题 简单dp
矩阵取数问题 一个N*N矩阵中有不同的正整数,经过这个格子,就能获得相应价值的奖励,从左上走到右下,只能向下向右走,求能够获得的最大价值。例如:3 * 3的方格。 1 3 32 1 32 2 1 能够获得的最大价值为:11。Input第1行:N,N为矩阵的大小。(2 <= N <= 500) 第2 - N + 1行:每行N个数,中间用空格隔...
2018-08-11 22:52:15 119
原创 hdu2345 子串查询 前缀和预处理
子串查询 度度熊的字符串课堂开始了!要以像度度熊一样的天才为目标,努力奋斗哦! 为了检验你是否具备不听课的资质,度度熊准备了一个只包含大写英文字母的字符串 A[1,n]=a1a2⋯anA[1,n]=a1a2⋯an,接下来他会向你提出 qq 个问题 (l,r)(l,r),你需要回答字符串 A[l,r]=alal+1⋯arA[l,r]=alal+1⋯ar 内有多少个非空子串是 A[l,r]A...
2018-08-11 22:44:46 166
原创 洛谷P1855 榨取kkksc03 01背包
洛谷的运营组决定,如果一名oier向他的教练推荐洛谷,并能够成功的使用(成功使用的定义是:该团队有20个或以上的成员,上传10道以上的私有题目,布置过一次作业并成功举办过一次公开比赛),那么他可以浪费掉kkksc03的一些时间的同时消耗掉kkksc03的一些金钱以满足自己的一个愿望。Kkksc03的时间和金钱是有限的,所以他很难满足所有同学的愿望。所以他想知道在自己的能力范围内,最多可以完成多...
2018-08-11 22:44:36 135
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人