- 博客(35)
- 收藏
- 关注
原创 Gym - 101350M
Every year, an elephant qualifies to the Arab Collegiate Programming Competition. He graduated this year, but that’s irrelephant. What’s important is that the location of the competition might not hav
2017-04-27 21:28:26 329
原创 Gym - 101350D
In a magical forest, there exists N bamboos that don't quite get cut down the way you would expect.Originally, the height of the ith bamboo is equal tohi. In one move, you can push down a bamboo
2017-04-27 21:26:50 398
原创 Gym - 101350C
There are N kangaroos going out to eat at an Indian restaurant. Theith kangaroo wants to eatexactly xi food. The kangaroos all want to order the same size of plates, but each one can order more th
2017-04-27 21:23:42 523
原创 I - Mirrored String II Gym - 101350I
Note: this is a harder version of Mirrored string I.The gorillas have recently discovered that the image on the surface of the water is actually a reflection of themselves. So, the next thing for th
2017-04-27 21:21:29 689
原创 ZOJ - 2855
GoogleMap is a useful tool and most of you should be familiar with it. As the best hacker in the world, Jack is planning to retrieve all the data on the GoogleMap server. But he soon gives up because
2017-04-27 21:14:34 286
原创 ZOJ - 2851
Some companies have special requirements for source code format, and it is also good for programmers to keep consistent code style. You are asked to write a simple code formatter for the company to he
2017-04-27 21:12:46 269
原创 Girls' research
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
2017-04-27 21:08:33 354
原创 B - 吉哥系列故事――完美队形II
吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h1 1, h2 2 ... hn n,吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,
2017-04-27 21:05:30 300
原创 Gym - 101350C
There are N kangaroos going out to eat at an Indian restaurant. Theith kangaroo wants to eatexactly xi food. The kangaroos all want to order the same size of plates, but each one can order more th
2017-04-23 11:59:55 553
原创 HDU - 4803 策略选择
Jenny is a warehouse keeper. He writes down the entry records everyday. The record is shown on a screen, as follow:There are only two buttons on the screen. Pressing the button in the first
2017-04-23 11:55:35 424
原创 HDU - 4811
Jenny likes balls. He has some balls and he wants to arrange them in a row on the table.Each of those balls can be one of three possible colors: red, yellow, or blue. More precisely, Jenny has R r
2017-04-23 11:49:26 403
转载 Manacher 算法 求最长字回文串
0. 问题定义最长回文子串问题:给定一个字符串,求它的最长回文子串长度。如果一个字符串正着读和反着读是一样的,那它就是回文串。下面是一些回文串的实例:12321 a aba abba aaaa tattarrattat(牛津英语词典中最长的回文单词)1. Brute-force 解法对于最长回文子串问题,最简单粗暴的办法是:找到字符串的所有子串,遍历每一个子串以
2017-04-22 19:50:54 255
原创 cf 789 B
Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbl
2017-04-19 21:03:49 670
原创 poj 2796 Feel Good
Feel GoodTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 14287 Accepted: 3950Case Time Limit: 1000MS Special JudgeDescriptionBill is developin
2017-04-15 19:22:26 299
原创 poj 2799 IP Networks
IP NetworksTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2307 Accepted: 880DescriptionAlex is administrator of IP networks. His clients have a bunch o
2017-04-15 19:10:35 681
原创 poj 2800 找规律
Joseph's ProblemTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7519 Accepted: 1977DescriptionJoseph likes taking part in programming contests. His favo
2017-04-15 19:02:09 630
转载 二维线段树
二维线段树最主要用于平面统计问题。类似一维线段树,最经典的就是求区间最值(或区间和),推广到二维,求得就是矩形区域最值(或矩形区域和),对于矩形区域和,二维树状数组更加高效,而矩形区域最值,更加高效的方法是二维RMQ,但是二维RMQ不支持动态更新,所以二维线段树还是有用武之地的。如果对一维线段树已经驾轻就熟,那么直接来看下面两段对比,就可以轻松理解二维线段树了。一维线段树是一棵二叉
2017-04-13 16:24:44 1591
转载 bkdr hash
BKDRHASH是一种字符哈希算法,像BKDRHash,APHash,DJBHash,JSHash,RSHash,SDBMHash,PJWHash,ELFHash等等,这些都是比较经典的,通过http://blog.csdn.net/wanglx_/article/details/40300363(字符串哈希函数)这篇文章,我们可知道,BKDRHash是比较好的一个获取哈希值的方法。下面就讲解这个
2017-04-10 22:29:22 600
原创 HDU - 4821 I - String 字符串哈希(bkdrhash)+成段求值+map去重
Given a string S and two integers L and M, we consider a substring of S as “recoverable” if and only if (i) It is of length M*L; (ii) It can be constructed by concatenating M “diversified” su
2017-04-10 22:27:03 634
原创 Little Tiger vs. Deep Monkey
A crowd of little animals is visiting a mysterious laboratory �C The Deep Lab of SYSU.“Are you surprised by the STS (speech to speech) technology of Microsoft Research and the cat face recogniti
2017-04-09 16:16:33 902
原创 - Hard Code
Some strange code is sent to Da Shan High School. It's said to be the prophet's note. The note is extremely hard to understand. However, Professor Meng is so smart that he successfully found the patte
2017-04-09 16:09:36 446
转载 快速排序
快速排序由于排序效率在同为O(N*logN)的几种排序方法中效率较高,因此经常被采用,再加上快速排序思想----分治法也确实实用,因此很多软件公司的笔试面试,包括像腾讯,微软等知名IT公司都喜欢考这个,还有大大小的程序方面的考试如软考,考研中也常常出现快速排序的身影。总的说来,要直接默写出快速排序还是有一定难度的,因为本人就自己的理解对快速排序作了下白话解释,希望对大家理解有帮助,达到快速
2017-04-09 11:46:03 401
原创 归并排序 小结
前几天做了一个逆序数的题,用到了归并排序,就可了解了一下,归并排序算是比较高效的排序算法,复杂度为o(n*lgn),分析问题可以分为三步1.划分问题2.递归求解3.是合并代码:#include #include #include #include #include using namespace std;//归并排序void merge_sort
2017-04-09 00:10:51 307
原创 uva1592 Database
Peter studies the theory of relational databases. Table in the relational database consists of values tare arranged in rows and columns.There are di?erent normal forms that database may adhere to.
2017-04-08 22:10:27 473
原创 Gym - 101308H
Problem H. HeadshotInput file: headshot.inOutput file: headshot.outYou have a revolver gun with a cylinder that has n chambers. Chambers are located in a circle on acylinder. Each chamber can
2017-04-08 21:58:24 360
原创 poj 3863 Business Center
International Cyber Police Corporation (ICPC) had built a new mega-tall business center to host itsheadquarters and to lease some space for extra profit. It has so many floors, that it is impractica
2017-04-07 19:17:19 574
原创 HDU - 4618 H - Palindrome Sub-Array
A palindrome sequence is a sequence which is as same as its reversed order. For example, 1 2 3 2 1 is a palindrome sequence, but 1 2 3 2 2 is not. Given a 2-D array of N rows and M columns, your task
2017-04-06 18:20:02 354
原创 HDU - 4619 I - Warm up 2
Some 1×2 dominoes are placed on a plane. Each dominoe is placed either horizontally or vertically. It's guaranteed the dominoes in the same direction are not overlapped, but horizontal and vertical do
2017-04-06 17:58:03 286
原创 HDU - 4611 A - Balls Rearrangement
Bob has N balls and A boxes. He numbers the balls from 0 to N-1, and numbers the boxes from 0 to A-1. To find the balls easily, he puts the ball numbered x into the box numbered a if x = a mod A. So
2017-04-05 17:32:50 366
原创 CodeForces - 789A A - Anastasia and pebbles
Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the p
2017-04-05 09:28:13 528
原创 Gym 100623I Important Wires
题意:给你很多语句,然后让你用这些语句组成一条语句使其值为1,思路:说了这么多,其实是大水题i,只要输出一个语句或上这条语句的非,其他的随便怎样都行ac代码:#include #include #include using namespacestd;int main(){ freopen("important.in","r",stdin
2017-04-05 09:18:13 253
原创 Gym - 100623E Enchanted Mirror
题意:给你四串字符,问你当1转化为3时,2能不能同时转化为4,交换规则是,i与j交换则n-i+1与n-j+1交换思路:把握一条就可以了,不管怎么换,一个字符i对应的那个字符n-i+1是不变的,ac代码:#include #include #include #include using namespacestd;char s1[105],s2[10
2017-04-05 09:12:40 524
原创 Gym - 100623C class
题意:在一个教室中老师按照学生的做的情况来确定出勤,确定规则是找到每一列的最大值然后找到每一行的最大值,然后取两者的最小值来衡量学生的出勤情况,现在给你出勤人数然后让你写出一种坐的方案,使老师计算的出勤最大思路:先确定最大情况的行列的人的个数然后把它们安排在第一行和第一列,然后剩下的随便填在其他位置,这种方案就可以了ac代码;#include #include #inc
2017-04-05 09:04:44 490
原创 Gym 100623B Billboard
题意:给你一个广告牌,然后上面能贴广告,每条广告占一行多列,给你广告牌的宽和高,给出很多广告让你输出它能贴在那一行(规则是上优先,然后左优先)思路:线段树维护一下区间最大值,然后每次查找最左边的即可ac代码:#include#include#include#define N 200010#define max(a,b) (a)>(b)?(a):(b)using na
2017-04-05 08:58:48 540
原创 hdu 4920 矩阵相乘
Given two matrices A and B of size n×n, find the product of them. bobo hates big integers. So you are only asked to find the result modulo 3. InputThe input consists of several tests. For each
2017-04-05 08:45:13 269
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人