自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 收藏
  • 关注

原创 HDU - 3282

For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After eachodd-indexedvalue is read, output the median (middle value) of the elements received so far....

2020-04-19 22:19:45 181

原创 POJ - 3280 dp

AP现在定义两个字符串操作。操作1:在任意位置添加一个字符char(只有小写字母),并花费a[char-'a']元操作2:在任意位置删除一个字符char(只有小写字母),并花费b[char-'a']元现在给你一个字符串S,问最少消耗多少花费使其变成回文串。Input第一行,两个整数由空格分开:N和M (1 ≤ M ≤ 2,000) (1 ≤ N ≤ 26)第二行,长度为M的字...

2020-04-10 22:28:04 174

原创 中国剩余定理 (互质和非互质)

中国剩余定理就是求x: x = a1 (mod m1) x = a2 (mod m2) ... ...

2019-08-06 10:29:51 186

原创 POJ - 3080 ( kmp 记个模板)

题目:POJ - 3080#include<stdio.h>#include<algorithm>#include<string.h>#include<queue>#include<set>using namespace std;#define LL long long#define maxn 400005int...

2019-07-30 10:35:25 126

原创 差分约束 链式前向星 (学习

在学习差分约束的时候先学了下链式前向星存图,因为这存的方便,也优化了最短路算法,具体代码如下:struct xxx{ int v,w; int next;}edge[maxn];int head[maxn];int cnt=0;void add(int u,int v,int w){ edge[cnt].v=v; edge[cnt].w=...

2019-07-30 10:24:35 131

原创 画图、xxx 各种函数

头文件 #include<graphics.h>建窗口 initgraph(540, 450); getchar(); closegraph();背景色 要刷新 setbkcolor(RED); cleardevice();画点 putpixel(x,y,RED);画线 颜色: setlinecolor(RED)...

2019-05-15 20:27:32 227

原创 Xor Sum(01字典树)

Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向人类求助。你能证明人类...

2019-04-29 19:34:57 123

原创 HDU - 1540 (线段树 区间合并)

During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...

2019-04-16 10:51:10 149

原创 JDG HDU - 2112(Dijkstrar)

经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,却一...

2019-04-10 20:57:36 134

原创 Shoring Up the Levees HDU - 3103 (已知坐标求三角形各种东西)

The tiny country of Waterlogged is protected by a series of levees that form a quadrilateral as shown below:The quadrilateral is defined by four vertices. The levees partition the country into...

2019-04-08 09:24:40 186

原创 CodeForces - 612D

在一个数轴上,给出n条线段。再给你一个整数k,请你找出所有能被任意k条线段同时覆盖的区间个数的最小值,并按从左到右的顺序输出每个区间。Input第一行给出两个正整数n和k(1 ≤ k ≤ n ≤ 106) —分别表示线段的数量和题目要求的k下面n行每行两个整数li, ri( - 109 ≤ li ≤ ri ≤ 109) —表示第i条线段的左右端点。请注意线段是无序给...

2019-04-02 09:03:37 179

原创 POJ - 3104(二分答案)

最让HSQ学长头疼的就是洗衣服了。洗完之后,每件衣服都有一定单位水分,在不使用烘干器的情况下,每件衣服每分钟自然流失1个单位水分,但如果使用了烘干机则每分钟流失K个单位水分。令人遗憾是HSQ所在的宿舍楼只有1台烘干机,而每台烘干机同时只能烘干1件衣服,请问要想烘干N件衣服最少需要多长时间?输入第一行输入N,表示有N件衣服,第二行输入N件衣服的水分ai,第三行表示烘干机每分钟烘干水分K其...

2019-04-01 19:25:03 1100

原创 HDU - 4722(初学数位dp)

If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number.You are required to count the number of good numbers in the range from A to B, i...

2019-04-01 16:32:09 156

原创 CodeForces - 203B

One not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.He took a checkered white square piece of paper, consisting ofn × ncells. A...

2019-04-01 10:24:59 171

原创 Bored Three-God (大数加法)

The bored Three-God get another boring question.This problem is ask you plus two big nubmer, please help him, when you solve thisproblem you canspeak to Three-God,"Oh, Please give me a diffculte...

2019-03-29 19:17:19 155

原创 You are my brother (树的深度)

Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Little B is his elder, younger or brother.Input...

2019-03-29 18:14:44 476

原创 无剑无我 HDU - 2547 (求两点距离)

北宋末年,奸臣当道,宦官掌权,外侮日亟,辽军再犯。时下战火连连,烽烟四起,哀鸿遍野,民不聊生,又有众多能人异士群起而反,天下志士云集响应,景粮影从。值此危急存亡之秋,在一个与世隔绝的地方---MCA山上一位江湖人称<英雄哪里出来>的人正在为抗击辽贼研究剑法,终于于一雷电交加之夜精确计算出了荡剑回锋的剑气伤害公式。定义 f(x, y, m, n) = sqrt(x*x + y*y...

2019-03-28 22:47:22 165

原创 Time (字符模拟数字)

Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the digital clock....

2019-03-28 22:37:30 585

原创 盒子嵌套 (几何题)

There is a large room in the Pyramid called Room-of-No-Return. Its floor is covered by rectangular tiles of equal size. The name of the room was chosen because of the very high number of traps and mec...

2019-03-27 13:33:26 487

原创 HDU - 1250 (大数加法)

A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-...

2019-03-26 23:32:44 174

原创 Networking (最小生成树 记个模板 )

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...

2019-03-25 21:31:46 94

原创 Max sum(简单dp)

Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe...

2019-03-25 21:25:36 150

原创 Silver Cow Party (Dijkstra 记个模板)

Silver Cow PartyOne cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirec...

2019-03-25 21:24:12 102

原创 求余数(大数取余)

题目描述:现在给你一个自然数n,它的位数小于等于一百万,现在你要做的就是求出这个数除10003之后的余数输入描述:第一行有一个整数m(1<=m<=8),表示有m组测试数据;随后m行每行有一个自然数n。输出描述:输出n整除10003之后的余数,每次输出占一行。样例输入:345465456541样例输出:456948相当于一段一...

2019-01-04 19:23:53 4981

原创 01背包 记下模板

01背包只要理解一个递推感觉就还行int dp[110][110];int w[110],v[110];//w体积 v价值int n,c;//n代表取的编号 c代表背包容量void dpdp(){ for(int i=1; i<=n; i++) { for(int j=0; j<=c; j++) { ...

2018-12-27 15:54:18 98

原创 Sudoku 数独(深搜)

题目Sudoku对数独非常感兴趣,今天他在书上看到了几道数独题:给定一个由3*3的方块分割而成的9*9的表格(如图),其中一些表格填有1-9的数字,其余的则为空白(数字0为空白)。请在空白表格中填入数字1-9使得9*9表格的每行、每列、每个3*3块内无重复数字。Input第一行输入一个整数T,表示样例数量。对于每个样例, 一共9行, 表示数独表格的每一行。接下来每一行输入一个字符...

2018-12-19 20:22:24 1574

原创 最小步数 (简单广搜)

题目这有一个迷宫,有0~8行和0~8列:1,1,1,1,1,1,1,1,11,0,0,1,0,0,1,0,11,0,0,1,1,0,0,0,11,0,1,0,1,1,0,1,11,0,0,0,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,1,0,0,11,1,0,1,0,0,0,0,11,1,1,1,1,1,1,1,10表示道...

2018-12-11 10:24:02 234

原创 Palindromes (水题)

题目A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string “ABCDEDCBA” is a palindrome because it is the same when the string is read from...

2018-11-30 09:03:59 372

原创 洛谷 p1464 Function(记忆化搜索)

题目描述对于一个递归函数w(a,b,c)w(a,b,c)如果a≤0orb≤0orc≤0就返回值1. 如果a>20 or b>20orc>20就返回w(20,20,20) 如果a<b并且b<c就返回w(a,b,c-1)+w(a,b-1,c-1)-w(a,b-1,c) 其它的情况就返回w(a−1,b,c)+w(a−1,b−1,c)+w(a−1,...

2018-11-29 20:21:07 466

原创 容斥原理简单题

题目求1~n中能被a或b或c整除的数的个数。输入每组数据占一行,依次包括整数n,a,b,c,直到输入0 0 0 0为止(1<=a,b,c<=n<=1e9)输出输出1~n中能被a或b或c整除的数的个数,每组占一行容斥原理为在计数时,必须注意没有重复,没有遗漏。为了使重叠部分不被重复计算,人们研究出一种新的计数方法,这种方法的基本思想是:先不考...

2018-11-29 20:08:47 214

原创 巴什博弈问题之取石子(博弈)

题目描述:一天,TT在寝室闲着无聊,和同寝的人玩起了取石子游戏,而由于条件有限,他/她们是用旺仔小馒头当作石子。游戏的规则是这样的。设有一堆石子,数量为N(1<=N<=1000000),两个人轮番取出其中的若干个,每次最多取M个(1<=M<=1000000),最先把石子取完者胜利。我们知道,TT和他/她的室友都十分的聪明,那么如果是TT先取,他/她会取得游戏的胜利么?...

2018-11-29 19:55:27 201

原创 Commando War(贪心)

题目或许每个人都有成为将军的梦想,小光也是如此。从小,小光就立志长大了以后要做一名军人,保家卫国。有一天,他做了一个梦,在梦里,他是一个英明神武的将军,但是敌国马上就要入侵了,作为将军的他责无旁贷需要挺身而出,于是他开始做一些战略部署。假设当前小光有n个部下,每个部下需要完成一项任务。第i个部下需要小光花Bi分钟交代任务,然后他会立刻独立地、无间断地执行Ji分钟后完成任务。小光需要选择交代...

2018-11-29 19:45:35 388

原创 Tian Ji -- The Horse Racing(贪心)

Here is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both of Ti...

2018-11-16 09:53:34 223

原创 nyoj-12-喷水装置(二)(贪心)

题目描述:有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(n<=10000)个点状的喷水装置,每个喷水装置i喷水的效果是让以它为中心半径为Ri的圆都被润湿。请在给出的喷水装置中选择尽量少的喷水装置,把整个草坪全部润湿。输入描述:第一行输入一个正整数N表示共有n次测试数据。每一组测试数据的第一行有三个整数n,w,h,n表示共有n个喷水装置,w表示草坪的横向...

2018-11-08 21:32:06 175

空空如也

空空如也

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

TA关注的人

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