自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

liluoyu_1016的博客

Act like a lady, think like a man.

  • 博客(122)
  • 收藏
  • 关注

原创 c++函数指针

c++ 函数指针

2022-09-26 14:57:40 518 1

原创 GCD HDU - 1695 莫比乌斯模板

Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you're...

2018-09-11 19:52:45 548

原创 hdu Character Encoding 容斥

In computer science, a character is a letter, a digit, a punctuation mark or some other similar symbol. Since computers can only process numbers, number codes are used to represent characters, which i...

2018-08-18 17:42:15 222

原创 bzoj 2818 Gcd 线性筛欧拉+想法

Description给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input一个整数NOutput如题Sample Input4 Sample Output4HINT hint对于样例(2,2),(2,4),(3,3),(4,2) 1<=N<=10^7 思路:假...

2018-08-18 17:21:44 158

原创 hdu 1028 Ignatius and the Princess III 生成函数 模板题

Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equ...

2018-08-18 09:55:34 190

原创 hdu 6395 Sequence 分块+矩阵快速幂

 Problem DescriptionLet us define a sequence as below ⎧⎩⎨⎪⎪⎪⎪⎪⎪F1F2Fn===ABC⋅Fn−2+D⋅Fn−1+⌊Pn⌋  Your job is simple, for each task, you should output Fn module 109+7.  InputThe first li...

2018-08-17 15:02:21 204

原创 hdu 6396 Swordsman 读入优化+思维

roblem DescriptionLawson is a magic swordsman with k kinds of magic attributes v1,v2,v3,…,vk. Now Lawson is faced with n monsters and the i-th monster also has k kinds of defensive attributes ai,1,a...

2018-08-17 11:27:13 229

原创 Anton and School - 2 CodeForces - 785D 组合数学 范德蒙恒等式

As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round ...

2018-08-03 17:33:34 224

原创 牛客网暑期ACM多校训练营(第四场) G

链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 题目描述The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly ...

2018-08-01 09:41:38 138

原创 poj 3254 Corn Fields 状压dp

Corn FieldsTime Limit: 2000MS   Memory Limit: 65536K Total Submissions: 19399   Accepted: 10189 DescriptionFarmer John has purchased a lush new rectangular pasture composed of M by...

2018-07-31 17:20:54 157

原创 Problem A. Ascending Rating hdu 6319 单调栈

Problem DescriptionBefore the start of contest, there are n ICPC contestants waiting in a long queue. They are labeled by 1 to n from left to right. It can be easily found that the i-th contestant's...

2018-07-31 17:18:43 164

原创 hdu 5094 Maze 状压 bfs

Problem DescriptionThis story happened on the background of Star Trek.Spock, the deputy captain of Starship Enterprise, fell into Klingon’s trick and was held as prisoner on their mother planet Qo’...

2018-07-31 17:05:58 218 1

原创 状压 bfs

http://119.23.43.230/problem.php?id=1234题目描述小z喜欢上了一个迷宫游戏,这个游戏是这样的,有一个N*M的迷宫(即N行M列的迷宫)保证0<N<=500,0<M<=500左上角坐标(1,1)为入口,右下角坐标(N,M)为出口,这个迷宫和一般迷宫不同的地方是,迷宫种可能会出现k个宝石(0<=k<=3),小z如果...

2018-07-31 16:51:24 418

原创 Detachment HDU - 5976 前缀+逆元+贪心

In a highly developed alien society, the habitats are almost infinite dimensional space. In the history of this planet,there is an old puzzle. You have a line segment with x units’ length representi...

2018-05-18 21:06:49 226

原创 最长回文 HDU - 3068 马拉车模板题

给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len Output 每一行一个整数x,对应一组case,表示该组c

2018-05-02 21:01:25 170

原创 Dual Core CPU POJ - 3469 经典最小割

As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, decided to update their famous product - SWODNIW.The routine consists of

2018-04-30 15:16:38 321

原创 Evacuation POJ - 3057 二分图匹配+bfs

Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushing out at t

2018-04-29 10:31:49 209

原创 Image copy detection HDU - 3523 最小费用流

The success of the Internet and cost-effective digital storage device has made it possible to replicate, transmit, and distribute digital content in an effortless way. Thus, the protection of intellec

2018-04-25 22:12:34 219

原创 Courses HDU - 1083 匈牙利算法模板

Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that sa

2018-04-23 21:59:42 172

原创 Flow Problem HDU - 3549 Dinic

Network flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted directed graph.Input The first line of input contains an inte

2018-04-19 19:21:40 149

原创 Drainage Ditches HDU - 1532 最大流 模板

Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Fa

2018-04-19 09:44:12 151

原创 K-th Number POJ - 2104 线段树 归并树

You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quic

2018-04-10 20:29:14 435

原创 统计难题 HDU - 1251 trie树

Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串

2018-03-25 10:20:44 141

原创 To Add or Not to Add CodeForces - 231C 尺取

A piece of paper contains an array of n integersa1, a2, ..., an. Your task is to find a number that occurs the maximum number of times in this array.However, before looking for such number, you ar

2018-03-24 20:33:29 201

原创 最长回文子串 马拉车算法

描述   小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路上一同前进。   这一天,他们遇到了一连串的字符串,于是小Hi就向小Ho提出了那个经典的问题:“小Ho,你能不能分别在这些字符串中找到它们每一个的最长回文子串呢?”   小Ho奇怪的问道:“什么叫做最长回文子串呢?”   小Hi回答道:“一个字符串中连续的一段就是

2018-03-21 16:38:52 248

原创 L2-001. 紧急救援 SPFA+记录路径,统计最短路

作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领你的救援队尽快赶往事发地,同时,一路上召集尽可能多的救援队。输入格式:输入第一行给出4个正整数N、M、S、D,其中N(2<=N<=500)是城市的个数,...

2018-03-17 15:59:17 252

原创 Safecracker HDU - 1015 DFS回溯 or 暴力

Safecrack === Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, along with K...

2018-03-13 18:27:52 161

原创 Tempter of the Bone HDU - 1010 dfs+剪枝

The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone

2018-03-13 17:42:40 166

原创 codeforces 939 A Love Triangle

As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There aren planes on Earth, numbered from 1 to n, and the plane with number i l

2018-03-10 17:27:02 165

原创 L1-039. 古风排版

中国的古人写文字,是从右向左竖向排版的。本题就请你编写程序,把一段文字按古风排版。输入格式:输入在第一行给出一个正整数N(输出格式:按古风格式排版给定的字符串,每列N个字符(除了最后一列可能不足N个)输入样例:4This is a test case输出样例:asa Tst ihe tsi ce s注意字符串结尾‘\0’,与空格不同

2018-03-06 20:50:02 135

原创 Cash Machine POJ - 1276 多重背包

A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k

2018-02-02 10:43:18 144

原创 To the Max POJ - 1050

Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of

2018-02-01 11:16:30 220

原创 机器人走方格 V2 51Nod - 1119 组合数学+逆元

M * N的方格,一个机器人从左上走到右下,只能向右或向下走。有多少种不同的走法?由于方法数量可能很大,只需要输出Mod 10^9 + 7的结果。 Input第1行,2个数M,N,中间用空格隔开。(2 <= m,n <= 1000000)Output输出走法的数量 Mod 10^9 + 7。Sample Input2 3Sample Output...

2018-01-29 19:21:59 188

原创 莫比乌斯函数 51Nod - 1240

莫比乌斯函数,由德国数学家和天文学家莫比乌斯提出。梅滕斯(Mertens)首先使用μ(n)(miu(n))作为莫比乌斯函数的记号。(据说,高斯(Gauss)比莫比乌斯早三十年就曾考虑过这个函数)。具体定义如下:如果一个数包含平方因子,那么miu(n) = 0。例如:miu(4), miu(12), miu(18) = 0。如果一个数不包含平方因子,并且有k个不同的质因子,那么miu

2018-01-29 11:21:13 191

原创 How far away ? HDU - 2586 M次spfa

There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it hard to

2018-01-29 10:35:25 151

原创 Fliptile POJ - 3279 开关问题

Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate anM × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 1

2018-01-27 17:14:50 316

原创 Sum of Consecutive Prime Numbers POJ - 2739 素数打表—埃氏筛法

Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has two repre

2018-01-26 16:18:10 187

原创 poj 1088 dfs+记忆化搜索

Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813

2018-01-24 15:01:18 206

原创 Color the ball HDU - 1556 线段树区间更新点查询

N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗?Input 每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。 Output 每个测试实例输

2018-01-24 10:52:26 187

原创 Coins POJ - 3210

Snoopy has three coins. One day he tossed them on a table then and tried to flip some of them so that they had either all heads or all tails facing up. After several attempts, he found that regardless

2018-01-22 10:44:31 232

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除