自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU - 5997 树状数组+set

和之前一道省选题目很像;(梦幻布丁);我们维护的时候用树状数组维护,在断电处打上标记;合并的时候小的合并到大的里面;#include<iostream>#include<cstdio>#include<algorithm>#include<cstdlib>#include<cstring>...

2019-01-31 22:35:00 144

原创 HDU - 5996 树上博弈 BestCoder Round #90

HDU - 5996 树上博弈 BestCoder Round #90 就是阶梯NIM博弈,那么看层数是不是奇数的异或就行了;#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstdlib&gt;#incl...

2019-01-31 22:25:00 210

原创 [JSOI2009]计数问题 二维树状数组BZOJ 1452

题目描述一个n*m的方格,初始时每个格子有一个整数权值。接下来每次有2种操作:改变一个格子的权值;求一个子矩阵中某种特定权值出现的个数。输入输出格式输入格式:第一行有两个数N,M。接下来N行,每行M个数,第i+1行第j个数表示格子(i,j)的初始权值。接下来输入一个整数Q。之后Q行,每行描述一个操作。操作1:“1 x y c...

2019-01-31 22:17:00 102

原创 THU 上机 最小邮票数 暴力枚举

THU 上机 最小邮票数 暴力枚举 链接:https://www.nowcoder.com/questionTerminal/83800ae3292b4256b7349ded5f178dd1?toCommentId=2533792来源:牛客网输入描述:    有多组数据,对于每组数据,首先是要求凑成的邮票总值M,M&lt;100。然后是一个数...

2019-01-31 22:08:00 145

原创 SJTU 机试 最小面积子矩阵 压缩+双指针

SJTU 机试 最小面积子矩阵 压缩+双指针 链接:https://www.nowcoder.com/questionTerminal/8ef506fbab2742809564e1a288358554来源:牛客网一个N*M的矩阵,找出这个矩阵中所有元素的和不小于K的面积最小的子矩阵(矩阵中元素个数为矩阵面积)输入描述:每个案例第一行三个正整数...

2019-01-31 21:21:00 104

原创 SJTU 机试 数学

题目描述给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除。输入描述:两个整数n(2<=n<=1000),a(2<=a<=1000)输出描述:一个整数.示例1输入复制6 10输出复制1分解质因数取min即可;#include<iostream&...

2019-01-31 16:38:00 178

原创 Preprefix sum BZOJ 3155 树状数组

Preprefix sum BZOJ 3155 树状数组 题目描述前缀和(prefix sum)Si=∑k=1iaiS_i=\sum_{k=1}^i a_iSi​=∑k=1i​ai​。前前缀和(preprefix sum) 则把SiS_iSi​作为原序列再进行前缀和。记再次求得前缀和第i个是SSiSS_iSSi​给一个长度n的序列a1,a2...

2019-01-31 09:32:00 146

原创 [HNOI2004]树的计数 BZOJ 1211 prufer序列

[HNOI2004]树的计数 BZOJ 1211 prufer序列 题目描述输入输出格式输入格式:输入文件第一行是一个正整数n,表示树有n个结点。第二行有n个数,第i个数表示di,即树的第i个结点的度数。其中1&lt;=n&lt;=150,输入数据保证满足条件的树不超过10^17个。输出格式:输出满足条件的树有多少棵。输入输出样...

2019-01-30 20:44:00 152

原创 [HAOI2006]聪明的猴子 BZOJ 2429 Kruskal

[HAOI2006]聪明的猴子 BZOJ 2429 Kruskal #include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstdlib&gt;#include&lt;cstring&gt;#include&lt;string...

2019-01-30 15:29:00 134

原创 [USACO10MAR]伟大的奶牛聚集 BZOJ 1827 树形dp+dfs

[USACO10MAR]伟大的奶牛聚集 BZOJ 1827 树形dp+dfs 题目描述Bessie is planning the annual Great Cow Gathering for cows all across the country and, of course, she would like to choose the mos...

2019-01-30 10:04:00 111

原创 [CQOI2007]涂色 BZOJ 1260 区间dp

[CQOI2007]涂色 BZOJ 1260 区间dp 题目描述假设你有一条长度为5的木版,初始时没有涂过任何颜色。你希望把它的5个单位长度分别涂上红、绿、蓝、绿、红色,用一个长度为5的字符串表示这个目标:RGBGR。每次你可以把一段连续的木版涂成一个给定的颜色,后涂的颜色覆盖先涂的颜色。例如第一次把木版涂成RRRRR,第二次涂成RGGGR,...

2019-01-29 19:39:00 94

原创 最小圆覆盖 [模板] BZOJ 1337&1336

最小圆覆盖 [模板] BZOJ 1337&amp;1336 题目描述给出N个点,让你画一个最小的包含所有点的圆。输入输出格式输入格式:先给出点的个数N,2&lt;=N&lt;=100000,再给出坐标Xi,Yi.(-10000.0&lt;=xi,yi&lt;=10000.0) 输出格式:输出圆的半径,及圆心的坐标,保留10位小...

2019-01-28 15:39:00 116

原创 [USACO08DEC]拍头Patting Heads 数学 BZOJ 1607

[USACO08DEC]拍头Patting Heads 数学 BZOJ 1607 题目描述It's Bessie's birthday and time for party games! Bessie has instructed the N (1 &lt;= N &lt;= 100,000) cows conveniently numbere...

2019-01-27 22:01:00 125

原创 [USACO07DEC]泥水坑Mud Puddles BFS BZOJ 1627

[USACO07DEC]泥水坑Mud Puddles BFS BZOJ 1627 题目描述Farmer John is leaving his house promptly at 6 AM for his daily milking of Bessie. However, the previous evening saw a heavy rai...

2019-01-27 21:46:00 199

原创 GCD - Extreme (II) UVA - 11426 数学

GCD - Extreme (II) UVA - 11426 数学 Given the value ofN, you will have to nd the value ofG. The de nition ofGis given below:G=i&lt;N∑i=1jN∑j=i+1GCD(i; j)...

2019-01-26 17:02:00 175

原创 [HEOI2012]采花 树状数组 BZOJ 2743

[HEOI2012]采花 树状数组 BZOJ 2743 题目描述萧薰儿是古国的公主,平时的一大爱好是采花。今天天气晴朗,阳光明媚,公主清晨便去了皇宫中新建的花园采花。花园足够大,容纳了n朵花,花有c种颜色(用整数1-c表示),且花是排成一排的,以便于公主采花。公主每次采花后会统计采到的花的颜色数,颜色数越多她会越高兴!同时,她有一癖好,她不...

2019-01-26 15:38:00 188

原创 Cheerleaders UVA - 11806 计数问题

Cheerleaders UVA - 11806 计数问题 In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Theirroles are substantial during breaks an...

2019-01-26 11:24:00 218

原创 AtCoder - 2568 最小割

AtCoder - 2568 最小割 There is a pond with a rectangular shape. The pond is divided into a grid with H rows and W columns of squares. We will denote the square at the i-th row f...

2019-01-25 14:16:00 186

原创 AtCoder - 2566 优先队列

AtCoder - 2566 优先队列 Let N be a positive integer.There is a numerical sequence of length 3N, a=(a1,a2,…,a3N). Snuke is constructing a new sequence of length 2N, a', by removi...

2019-01-25 13:49:00 240

原创 AtCoder - 2565 枚举+贪心

AtCoder - 2565 枚举+贪心 There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the ...

2019-01-25 13:44:00 439

原创 AtCoder - 2581 树状数组

AtCoder - 2581 树状数组 You are given an integer sequence of length N, a= {a1,a2,…,aN}, and an integer K.a has N(N+1)⁄2 non-empty contiguous subsequences, {al,al+1,…,ar} (1≤l≤r≤...

2019-01-25 13:41:00 247

原创 atcoder 2579

atcoder 2579 You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is si. Your answer to each ques...

2019-01-25 13:36:00 232

原创 atcoder 2643 切比雪夫最小生成树

atcoder 2643 切比雪夫最小生成树 There are N towns on a plane. The i-th town is located at the coordinates (xi,yi). There may be more than one town at the same coordinates.You can buil...

2019-01-25 13:32:00 442

原创 Fxx and game hdu 5945 单调队列dp

Fxx and game hdu 5945 单调队列dp  dfs你怕是要爆炸考虑dp;很容易想到 dp[ i ] 表示到 i 时的最少转移步数;那么: dp[ i ]= min( dp[ i ],dp[ i-j ]+1 );其中 i-t&lt;=j&lt;=i;当 i%k==0时 ,dp[ i ]=min( dp[ i ],dp[ ...

2019-01-23 23:00:00 150

原创 方差 线段树

方差 线段树 题目背景滚粗了的HansBug在收拾旧数学书,然而他发现了什么奇妙的东西。题目描述蒟蒻HansBug在一本数学书里面发现了一个神奇的数列,包含N个实数。他想算算这个数列的平均数和方差。输入输出格式输入格式:第一行包含两个正整数N、M,分别表示数列中实数的个数和操作的个数。第二行包含N个实数,其中第i个实数表示数列的第i...

2019-01-23 20:26:00 161

原创 教主的花园 dp

教主的花园 dp 题目描述教主有着一个环形的花园,他想在花园周围均匀地种上n棵树,但是教主花园的土壤很特别,每个位置适合种的树都不一样,一些树可能会因为不适合这个位置的土壤而损失观赏价值。教主最喜欢333种树,这3种树的高度分别为10,20,3010,20,3010,20,30。教主希望这一圈树种得有层次感,所以任何一个位置的树要比它相邻的两...

2019-01-23 10:44:00 216

原创 Codeforces Round #534 (Div. 2) D. Game with modulo 交互题

Codeforces Round #534 (Div. 2) D. Game with modulo 交互题  先二分一个区间,再在区间里面二分即可;可以仔细想想,想明白很有意思的;#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;#incl...

2019-01-23 09:57:00 210

原创 传球游戏 dp

传球游戏 dp 题目描述上体育课的时候,小蛮的老师经常带着同学们一起做游戏。这次,老师带着同学们一起做传球游戏。游戏规则是这样的:nnn个同学站成一个圆圈,其中的一个同学手里拿着一个球,当老师吹哨子时开始传球,每个同学可以把球传给自己左右的两个同学中的一个(左右任意),当老师再次吹哨子时,传球停止,此时,拿着球没有传出去的那个同学就是败者,要...

2019-01-22 10:13:00 73

原创 [POI2009]KAM-Pebbles BZOJ1115 [ 待填坑 ] 博弈

[POI2009]KAM-Pebbles BZOJ1115 [ 待填坑 ] 博弈 有N堆石子,除了第一堆外,每堆石子个数都不少于前一堆的石子个数。两人轮流操作每次操作可以从一堆石子中移走任意多石子,但是要保证操作后仍然满足初始时的条件谁没有石子可移时输掉游戏。问先手是否必胜。感谢MT大牛翻译.Sample OutputNIE TAKHintI...

2019-01-22 09:51:00 124

原创 打谷机 BZOJ 1603 模拟

打谷机 BZOJ 1603 模拟 Farmer John有一个过时的打谷机(收割小麦),它需要带子来带动。发动机驱动轮1总是顺时针旋转的,用来带动转轮2,转轮2来带动转轮3,等等。一共有n(2&lt;=n&lt;=1000)个转轮(n-1条带子)。 上面的图解描述了转轮的两种连接方式,第一种方式使得两个轮子旋转的方向相同,第二种则相反。 给出一...

2019-01-21 20:53:00 135

原创 Gym - 101845K 排序+概率

Gym - 101845K 排序+概率 The UNAL programming coaches have lost a bet, they bet the 6 UNAL teams would occupy the first six positions in the regional finals. Now, they have to sha...

2019-01-21 20:25:00 607

原创 Gym - 101845F 最大流

Gym - 101845F 最大流 The UN finals are here!, the coaches/ex-coaches team is creating a new exciting contest to select which teams will compete in the Colombian finals. Ivan sai...

2019-01-21 20:19:00 345

原创 Gym - 101845D 计算几何

Ignacio is a famous mathematician, some time ago he was married with Dolly, a famous scientific, at that time they bought a huge piece of land that they would use to construct a national universi...

2019-01-21 20:17:00 126

原创 删数 记忆化搜索

删数 记忆化搜索 题目描述有N个不同的正整数数x1, x2, ... xN 排成一排,我们可以从左边或右边去掉连续的i(1≤i≤n)个数(只能从两边删除数),剩下N-i个数,再把剩下的数按以上操作处理,直到所有的数都被删除为止。每次操作都有一个操作价值,比如现在要删除从i位置到k位置上的所有的数。操作价值为|xi – xk|*(k-i+1),...

2019-01-21 10:27:00 217

原创 Codeforces Round #533 (Div. 2) 部分题解A~D

Codeforces Round #533 (Div. 2) 部分题解A~D A. Salem and Sticks题目描述Salem gave you n n n sticks with integer positive lengths a1,a2,…,an a_1, a_2, \ldots, a_n a1​,a2​,…,an​ .For ...

2019-01-21 10:06:00 125

原创 CF1088C Ehab and a 2-operation task 构造

CF1088C Ehab and a 2-operation task 构造    最简单的就是变成1~n的序列;我们可以先加一个极大的数防止出现负数;然后对于每一个%(a[ i ] - i);#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;algorithm&...

2019-01-20 09:56:00 166

原创 CF581D Three Logos 暴力

CF581D Three Logos 暴力 Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a...

2019-01-20 00:07:00 184

原创 CF581C Developing Skills 模拟

CF581C Developing Skills 模拟 Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, ea...

2019-01-20 00:06:00 170

原创 CF581B Luxurious Houses 模拟

CF581B Luxurious Houses 模拟 The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one ro...

2019-01-20 00:04:00 146

原创 [USACO08FEB]酒店Hotel 线段树 BZOJ 1593

[USACO08FEB]酒店Hotel 线段树 BZOJ 1593 题目描述The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Sup...

2019-01-19 21:03:00 132

空空如也

空空如也

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

TA关注的人

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