思维/规律
junior19
abcde
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
CF1132C:Painting the Fence(暴力)
C. Painting the Fencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a long fence which consists ofnnsections. Unfort...原创 2019-03-06 22:01:42 · 850 阅读 · 0 评论 -
CF827B:High Load(树 & 构造)
B. High Loadtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputArkady needs your help again! This time he dec原创 2017-07-25 22:14:00 · 469 阅读 · 0 评论 -
CodeChef:Centeroid(树的构造)
思路:假如b=2,中心为A,重心为B,那么A-X-B,为了令A和B合法,必须添加节点X-X-A-X-B-(XXX),这就是b=2时需要的最少节点数,B每增大1就要增加4个节点;当b=0和b=1时有一些细节要处理。# include using namespace std;int main(){ int t, n, b; scanf("%d",&t); while(原创 2017-08-16 23:50:53 · 502 阅读 · 0 评论 -
HDU5288:OO’s Sequence(思维)
OO’s SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 4011 Accepted Submission(s): 1484Problem DescriptionOO has got原创 2017-07-24 20:10:19 · 245 阅读 · 0 评论 -
CF798D:Mike and distribution(思维 )^
D. Mike and distributiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has always been thinking abou原创 2017-08-08 20:07:49 · 378 阅读 · 0 评论 -
CF830B:Cards Sorting(思维)
B. Cards Sortingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasily has a deck of cards consisting of n原创 2017-07-23 16:00:02 · 1569 阅读 · 0 评论 -
POJ3318:Matrix Multiplication(矩阵相乘)
Matrix MultiplicationTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 19099 Accepted: 4108DescriptionYou are given three n × n matrices A, B and C. Doe原创 2017-08-07 20:21:58 · 700 阅读 · 0 评论 -
CF152C: Pocket Book(思维)
C. Pocket Booktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day little Vasya found mom's pocket book原创 2017-08-07 16:12:39 · 385 阅读 · 0 评论 -
CF375D:Tree and Queries(树上莫队)
D. Tree and Queriestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a rooted tree consisting of n v原创 2017-07-22 18:10:14 · 275 阅读 · 0 评论 -
BZOJ2038:小Z的袜子(莫队算法)
A1206. 小Z的袜子时间限制:1.0s 内存限制:512.0MB 总提交次数:1578 AC次数:478 平均分:49.23将本题分享到: 查看未格式化的试题 提交 试题讨论试题来源 2010中国国家集训队命题答辩问题描述 作为一个生活散漫的人,小Z原创 2017-07-22 16:02:29 · 258 阅读 · 0 评论 -
AtCoder:Fennec VS. Snuke(dfs & 思维)
D - Fennec VS. SnukeTime limit : 2sec / Memory limit : 256MBScore : 400 pointsProblem StatementFennec and Snuke are playing a board game.On the board, there are N cells numbere原创 2017-07-21 12:08:32 · 832 阅读 · 0 评论 -
AtCoder:guruguru(思维 & 差分)
E - guruguruTime limit : 2sec / Memory limit : 256MBScore : 700 pointsProblem StatementSnuke is buying a lamp. The light of the lamp can be adjusted to m levels of brightness, re原创 2017-07-08 18:23:34 · 769 阅读 · 0 评论 -
AGC018:Coins(优先队列 & 思维)
C - CoinsTime limit : 2sec / Memory limit : 256MBScore : 800 pointsProblem StatementThere are X+Y+Z people, conveniently numbered 1 through X+Y+Z. Person i has Ai gold coins,原创 2017-07-29 14:06:47 · 457 阅读 · 0 评论 -
CF813B:The Golden Age(数学)
B. The Golden Agetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputUnlucky year in Berland is such a year tha原创 2017-07-28 10:33:37 · 469 阅读 · 0 评论 -
CodeChef:Chef and Subsequences(思维 & dfs)
Though our Head Chef retired from sport programming long back, but that did not affect his passion to contribute to the programming community. He still remains engaged by creating new problems and pas原创 2017-09-15 21:41:33 · 304 阅读 · 0 评论 -
CF854C:Planning(思维)
C. Planningtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputHelen works in Metropolis airport. She is respon原创 2017-09-08 20:27:14 · 417 阅读 · 0 评论 -
ZOJ4046:Good Permutation(逆序数)
题目链接题意:给N(1e5)个数的一个全排列,每次可以交换相邻的数,问最小交换次数达到数组满足a[i+1] = (a[i]%n)+1。思路:假如换成1,2,3...n的排列,显然答案就是逆序数,那么加如1最终在位置2,留意到逆序数的变化与数字5的位置有关,因为数字5要最终去位置1了,所以枚举1的最终位置,过程O(1)维护逆序数。# include <bits/stdc++.h&...原创 2018-10-10 17:33:25 · 479 阅读 · 0 评论 -
BZOJ3262:陌上花开(CDQ分治 + BIT)
Description有n朵花,每朵花有三个属性:花形(s)、颜色(c)、气味(m),用三个整数表示。现在要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量。定义一朵花A比另一朵花B要美丽,当且仅Sa>=Sb,Ca>=Cb,Ma>=Mb。显然,两朵花可能有同样的属性。需要统计出评出每个等级的花的数量。Input第一行为N,K (1 <= N ...原创 2018-08-19 22:31:14 · 324 阅读 · 0 评论 -
CF989C:A Mist of Florescence(构造)
C. A Mist of Florescencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs the boat drifts down the river, a wood full of blossoms shows up on the ...原创 2018-06-15 01:17:15 · 535 阅读 · 0 评论 -
ARC090:Number of Digits(思维 & 计数)
F - Number of DigitsTime limit : 2sec / Memory limit : 256MBScore : 900 pointsProblem StatementFor a positive integer n, let us define f(n) as the number of digits in base 10.You are given an integer ...原创 2018-02-25 22:27:54 · 953 阅读 · 0 评论 -
51nod选择子序列:单调栈 & 分治
1153 选择子序列 题目来源: Codility基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注长度为N的整数数组A,所有的数均不相同,假设下标从0开始。找到一个最长的数组B,B数组的长度为K,数值范围是0 - N - 1,记录的是A数组的下标。满足A[B[0]] > A[B[1]] > A[B[2]] >...A[B[K]],并且...原创 2018-02-17 23:35:25 · 297 阅读 · 0 评论 -
BZOJ2241:打地鼠(二维前缀和 & 思维)
2241: [SDOI2011]打地鼠Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 1479 Solved: 946[Submit][Status][Discuss]Description打地鼠是这样的一个游戏:地面上有一些地鼠洞,地鼠们会不时从洞里探出头来很短时间后又缩回洞中。玩家的目标是在地鼠伸出头时,用锤子砸其头部,砸到的地鼠越多分数也就越原创 2018-01-18 00:24:08 · 537 阅读 · 0 评论 -
CF911D:Inversion Counting(逆序数 & 思维)
D. Inversion Countingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA permutation of size n is an array o原创 2018-01-13 11:20:08 · 1127 阅读 · 0 评论 -
CF900C:Remove Extra One(思维)
C. Remove Extra Onetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of length原创 2017-12-14 21:23:41 · 856 阅读 · 0 评论 -
CF894B:Ralph And His Magic Field(思维)
B. Ralph And His Magic Fieldtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRalph has a magic field which i原创 2017-11-24 10:39:11 · 417 阅读 · 0 评论 -
CodeChef:Desik And Divisors(数学 & 二分 & 思维)
Given two integers L and K. You are to find the minimum integer R such that Sum of the number of divisors of all numbers from L to R is greater than K.InputFirst Line specifies an integer T, the numbe...原创 2017-12-03 19:00:12 · 251 阅读 · 0 评论 -
CF868C:Qualification Rounds(思维)
C. Qualification Roundstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSnark and Philip are preparing the原创 2017-10-10 13:17:20 · 440 阅读 · 0 评论 -
CodeChef:Magic Board(思维 & 树状数组)
All submissions for this problem are available.Long long ago, there is a magic board. The magic board has N*N cells: N rows and Ncolumns. Every cell contains one integer, which is 0 initially. L原创 2017-09-03 12:03:34 · 495 阅读 · 0 评论 -
CFgym:Magic Artifact(概率期望 & 思维)
"C" Magic ArtifactTime limit2 secondsMemory limit256 megabytesMaxim is playing a video game. It has n levels, numbered from 1 to n. Levels can be completed in原创 2017-07-16 21:37:34 · 342 阅读 · 0 评论 -
CF822C:Hacker, pack your bags!(思维)
C. Hacker, pack your bags!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's well known that the best wa原创 2017-07-06 13:40:04 · 1721 阅读 · 0 评论 -
AtCoder:Connected?(思维)
E - Connected?Time limit : 2sec / Memory limit : 256MBScore : 700 pointsProblem StatementSnuke is playing a puzzle game. In this game, you are given a rectangular board of dimensio原创 2017-06-27 16:56:10 · 434 阅读 · 0 评论 -
HDU6021:MG loves string(思维 & 容斥)
MG loves string Accepts: 30 Submissions: 67 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)问题描述MGMG是一个很忙碌的男孩子。今天他沉迷于这样一个问题:原创 2017-05-11 00:55:29 · 686 阅读 · 0 评论 -
SCUT校赛131:小P玩游戏II(贪心 & 思维)
题目描述小PP最近迷上了一个游戏,但他在玩游戏的时候遇到了一个问题。小PP控制nn 个角色,标号为11到nn,小PP有KK个怪物可以分配给这nn个角色击杀,一个怪物只能分配给一个角色,并且必须要分配给一个角色。对于第 i\,(1 \leq i \leq n)i(1≤i≤n)个角色,如果没有分配到一个怪物,那么它就会获得经验c_ici,如果分配到了t\,(t \geq原创 2017-05-01 12:25:58 · 630 阅读 · 0 评论 -
SCUT校赛130:对抗女巫的魔法碎片(思维)
题目描述光明世界的一个国家发生动荡,女巫利用了邪恶的力量将国家的村庄都施下了咒语,好在国家还有英勇的士兵,他们正义的力量能够破解这些魔咒夺回村庄,并且得到魔法碎片,利用足够多的魔法碎片可以将女巫铲除。现在已经被魔咒封印的村庄有mm个,编号为11到mm。英勇的士兵nn个,编号从11到nn。第ii个士兵攻击力为a_iai,第jj个村庄防御力为b_jbj,魔法价值为c_ici原创 2017-04-30 15:56:47 · 715 阅读 · 4 评论 -
51nod1682:中位数计数(前缀和)
1682 中位数计数基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。现在有n个数,每个数都是独一无二的,求出每个数在多少个包含其的区间中是中位数。原创 2017-03-15 23:58:53 · 467 阅读 · 0 评论 -
HDU5586:Sum(最大连续字段和)
SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1490 Accepted Submission(s): 758Problem DescriptionThere is a number seque原创 2017-03-23 19:28:54 · 359 阅读 · 0 评论 -
ZZUOJ10471: 数列游戏 I(差分数列)
10471: 数列游戏 ITime Limit: 2 Sec Memory Limit: 128 MBSubmit: 63 Solved: 13[Submit][Status][Web Board]Description给定一个长度为N的序列,首先进行A次操作,每次操作在Li和Ri这个区间加上一个数Ci。然后有B次询问,每次询问Li到Ri的区间和。初原创 2017-03-14 16:13:29 · 1229 阅读 · 0 评论 -
COGS1190:最大和(前缀和)
1190. [福州培训2010] 最大和★☆ 输入文件:maxsum.in 输出文件:maxsum.out 简单对比时间限制:1 s 内存限制:128 MB【题目描述】N个数围成一圈,要求从中选择若干个连续的数(注意每个数最多只能选一次)加起来,问能形成的最大的和。【输入格式】第一行输入N,表示数字的个数,第二行输入这N个数字。【原创 2017-03-14 15:37:29 · 731 阅读 · 1 评论 -
CF560B:Gerald is into Art(思维)
B. Gerald is into Arttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGerald bought two very rare paintings原创 2017-03-23 17:50:35 · 703 阅读 · 0 评论 -
GDUT2017校赛:Problem E: 倒水(Water)(思维,二进制)
Problem E: 倒水(Water)Description一天,CC买了N个容量可以认为是无限大的瓶子,开始时每个瓶子里有1升水。接着~~CC发现瓶子实在太多了,于是他决定保留不超过K个瓶子。每次他选择两个当前含水量相同的瓶子,把一个瓶子的水全部倒进另一个里,然后把空瓶丢弃。(不能丢弃有水的瓶子)显然在某些情况下CC无法达到目标,比如N=3,K=1。此时原创 2017-03-28 13:48:40 · 373 阅读 · 0 评论
分享