![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
Marcus-Bao
这个作者很懒,什么都没留下…
展开
-
qduoj 96 一道非常简单的签到题
一道非常简单的签到题发布时间: 2016年7月2日 20:32 最后更新: 2016年7月2日 21:48 时间限制: 1000ms 内存限制: 128M描述给你k,a,b三个数,问[a,b]区间内有多少个数可以整除k。(n / k == 0)输入多组输入,即输入包括多行,每行三个数k,a,b。 其中1 ≤ k ≤ 10^18,-原创 2016-11-06 18:47:42 · 2520 阅读 · 0 评论 -
hdu 5744 Keep On Movin
Description上回书说道不愿透露姓名的巨巨还剩下一个数组,这个数组记录了他学习c++ 语言的过程。现在这个数组a里有一些字符,第i个字符的数量是a[i]。巨巨想用这些字符来构造一些回文串好让他的程序通过编译。他想知道各种组合方案中最短字符串长度的最大值。 举个栗子:现在有 ‘a’, ‘b’, ‘c’, ‘d’ 四种字符并且他们的数量是 {2,3,2,2} 巨巨可原创 2016-11-28 21:17:30 · 508 阅读 · 0 评论 -
hdu 5500 Reorder the books 思维
Description河老师家收藏了卢西奥写的一套书,叫做《混子故事集》,这套书有n本,每本书有一个编号,从1号到n号,河老师非常喜欢这套书,并把这些书按编号从小到大,从上往下摞成一摞。 有一天,一个妹子LMG到河老师家玩,河老师因为和别的妹子有约会,就让LMG自己待在他家。LMG对这套书非常好奇,偷偷的看了一下,结果发现这里面竟然有当年CerberuX玩半藏,并与LMG邂逅国王大原创 2016-11-28 21:33:03 · 483 阅读 · 0 评论 -
Codeforces Round #381 (Div. 2) C. Alyona and mex(思维)
C. Alyona and mextime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlyona's mother wants to present an array原创 2016-11-28 21:43:49 · 491 阅读 · 0 评论 -
pat B 1050 螺旋矩阵(25)
1050. 螺旋矩阵(25)时间限制150 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue本题要求将给定的N个正整数按非递增的顺序,填入“螺旋矩阵”。所谓“螺旋矩阵”,是指从左上角第1个格子开始,按顺原创 2016-11-29 15:02:54 · 1087 阅读 · 0 评论 -
QUTOJ 1361 字符串匹配 暴力
1361: 字符串的匹配时间限制: 1 Sec 内存限制: 128 MB提交: 37 解决: 12题目描述相信大家都做许多的字符串匹配问题了,一天,503集训室的俊哥突然想出了新点子。现在给你两个字符串a,b求最长公共子串。对于是字符串匹配大师的你来说,这个再简单不过了。但是,如果现在你有k次修改机会,每次你都可以选择其中某个串的某个位置。将其修改成任意字符。你需要原创 2016-11-29 23:19:18 · 592 阅读 · 0 评论 -
QUTOJ 1359: 小菜的难题 最小值最大化问题 二分
1359: 小菜的难题时间限制: 1 Sec 内存限制: 128 MB提交: 50 解决: 22题目描述青岛理工大学的王小菜同学老是喜欢给周围同学出一些难题,回答不上来的同学就会面临请他吃饭的惩罚。一天,小菜碰见了小石,小菜出了一道题想考考小石。题目是这样的:现在给你n个数,让你从中选出k个数。选出后计算这k个数的两两之差的绝对值的最小值S。你需要选出哪k个数,才能原创 2016-11-30 00:15:54 · 857 阅读 · 0 评论 -
QUTOJ 1357:小E与计算器 暴力搞
1357: 小E与计算器时间限制: 1 Sec 内存限制: 128 MB提交: 145 解决: 19题目描述小E学完C语言之后,想写一个计算器。刚开始行云流水般把+,-,x功能给写完了。但是遇到了除法,小E就。万能的ACMer,你能帮助的小E完成除法功能吗?小E要实现的计算器的除法显示,如表所示:算式计算器显示结果循环小数的循原创 2016-12-01 00:27:27 · 998 阅读 · 0 评论 -
Pat 1035 插入与归并 思维
1035. 插入与归并(25)时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue根据维基百科的定义:插入排序是迭代算法,逐一获得输入数据,逐步产生有序的输出序列。每步迭代中,算法从原创 2016-12-10 18:59:52 · 627 阅读 · 0 评论 -
CodeForces - 611B 数学思维
The year 2015 is almost over.Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary s原创 2016-12-10 20:04:35 · 551 阅读 · 0 评论 -
CodeForces - 357C C - Knight Tournament 并查集or set模拟
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.As原创 2016-12-11 16:09:09 · 829 阅读 · 0 评论 -
CodeForces - 148B B - Escape xjb模拟
The princess is going to escape the dragon's cave, and she needs to plan it carefully.The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover th原创 2016-12-11 16:21:15 · 470 阅读 · 0 评论 -
Codeforces Round #379 (Div. 2) D 模拟
D. Anton and Chesstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to play chess. Also, he like原创 2016-11-18 21:47:53 · 494 阅读 · 0 评论 -
Codeforces Round #379 (Div. 2) C 二分or暴力优化
C. Anton and Making Potionstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton is playing a very interes原创 2016-11-18 21:15:49 · 422 阅读 · 0 评论 -
CodeForces 66B 暴力
B - bTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 66BDescriptionLittle Petya often travels to his grandmother原创 2016-12-04 16:55:40 · 508 阅读 · 1 评论 -
CodeForces 66D 数学构造
D - dTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 66DDescriptionLittle Petya has a birthday soon. Due this won原创 2016-12-04 17:05:20 · 492 阅读 · 0 评论 -
CodeForces 359B 构造
C - CTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit Status Practice CodeForces 359BDescriptionA permutation p is an ordered group of number原创 2016-12-04 16:49:46 · 618 阅读 · 0 评论 -
HDOJ 1042 N! 大数
Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! InputOne N in one line, process to the end of file. OutputFor each N, output N! in one line. Sample Input123思路:没啥思路啊原创 2016-12-06 00:08:39 · 509 阅读 · 0 评论 -
hdu 5922 Minimum’s Revenge 贪心
B - Minimum’s RevengeTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 5922DescriptionThere is a graph of n vertices which原创 2016-11-24 21:49:52 · 606 阅读 · 0 评论 -
B. Arpa’s obvious problem and Mehrdad’s terrible solution #383 B
B. Arpa’s obvious problem and Mehrdad’s terrible solutiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTh原创 2016-12-08 00:19:13 · 463 阅读 · 0 评论 -
nyoj 127 星际之门(一)
星际之门(一)时间限制:3000 ms | 内存限制:65535 KB难度:3描述公元3000年,子虚帝国统领着N个星系,原先它们是靠近光束飞船来进行旅行的,近来,X博士发明了星际之门,它利用虫洞技术,一条虫洞可以连通任意的两个星系,使人们不必再待待便可立刻到达目的地。帝国皇帝认为这种发明很给力,决定用星际之门把自己统治的各个星系连结在一起。原创 2016-11-05 19:02:32 · 286 阅读 · 0 评论 -
蓝桥杯训练 表达式计算
算法训练 表达式计算 时间限制:1.0s 内存限制:256.0MB问题描述 输入一个只包含加减乖除和括号的合法表达式,求表达式的值。其中除表示整除。输入格式 输入一行,包含一个表达式。输出格式 输出这个表达式的值。样例输入1-2+3*(4-5)样例输出-4数据规模和约原创 2017-02-01 20:47:14 · 5714 阅读 · 1 评论 -
蓝桥杯 算法训练 最大最小公倍数
算法训练 最大最小公倍数 时间限制:1.0s 内存限制:256.0MB 问题描述已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。输入格式输入一个正整数N。输出格式输出一个整数,表示你找到的最小公倍数。样例输入9样例输出504数据原创 2017-02-06 21:00:34 · 712 阅读 · 0 评论 -
pat 1062. 最简分数(20) 水
1062. 最简分数(20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue一个分数一般写成两个整数相除的形式:N/M,其中M不为0。最简分数是指分子和分母没有公约数的分数表示形式。原创 2017-02-21 15:49:49 · 810 阅读 · 0 评论 -
hdu 6011 Lotus and Characters 思维
问题描述Lotus有nn种字母,给出每种字母的价值以及每种字母的个数限制,她想构造一个任意长度的串。定义串的价值为:第1位字母的价值*1+第2位字母的价值*2+第3位字母的价值*3……求Lotus能构造出的串的最大价值。(可以构造空串,因此答案肯定\geq 0≥0)输入描述第一行是数据组数T(0 \leq T \leq 1000)T(0≤T≤1000)。对于每组数据,第一行原创 2017-01-23 19:43:49 · 994 阅读 · 0 评论 -
hdu 6012 Lotus and Horticulture 思维+前缀和处理
问题描述这几天Lotus对培养盆栽很感兴趣,于是她想搭建一个温室来满足她的研究欲望。Lotus将所有的nn株盆栽都放在新建的温室里,所以所有盆栽都处于完全相同的环境中。每一株盆栽都有一个最佳生长温度区间[l,r][l,r],在这个范围的温度下生长会生长得最好,但是不一定会提供最佳的研究价值(Lotus认为研究发育不良的盆栽也是很有研究价值的)。Lotus进行了若干次试验,发现若第ii株盆原创 2017-01-23 19:58:27 · 536 阅读 · 0 评论 -
CodeForces - 361A B - Levko and Table 思维
Levko loves tables that consist of n rows and n columns very much. He especially loves beautiful tables. A table is beautifulto Levko if the sum of elements in each row and column of the table equal原创 2017-02-21 23:09:26 · 543 阅读 · 0 评论 -
CodeForces - 361B D - Levko and Permutation 构造
Levko loves permutations very much. A permutation of length n is a sequence of distinct positive integers, each is at most n.Let’s assume that value gcd(a, b) shows the greatest common divisor of nu原创 2017-02-21 23:11:47 · 503 阅读 · 0 评论 -
CodeForces - 361C A - Levko and Array Recovery 思维
Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one原创 2017-02-21 23:19:30 · 470 阅读 · 0 评论 -
基础练习 回形取数 暴力
问题描述 回形取数就是沿矩阵的边取数,若当前方向上无数可取或已经取过,则左转90度。一开始位于矩阵左上角,方向向下。输入格式 输入第一行是两个不超过200的正整数m, n,表示矩阵的行和列。接下来m行每行n个整数,表示这个矩阵。输出格式 输出只有一行,共mn个数,为输入矩阵回形取数得到的结果。数之间用一个空格分隔,行末不要有多余的空格。样例输入原创 2017-02-22 20:36:32 · 1023 阅读 · 0 评论 -
Codeforces Round #394 (Div. 2) A---D
A. Dasha and Stairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn her way to programming school tiger原创 2017-02-02 22:03:48 · 539 阅读 · 0 评论 -
CodeForces - 363C Fixing Typos
Many modern text editors automatically check the spelling of the user's text. Some editors even suggest how to correct typos.In this problem your task to implement a small functionality to correct t原创 2017-02-24 13:37:49 · 403 阅读 · 0 评论 -
C - Matrix CodeForces - 365C 思维
You have a string of decimal digits s. Let's define bij = si·sj. Find in matrix b the number of such rectangles that the sum bij for all cells (i, j) that are the elements of the rectangle equals原创 2017-03-03 19:59:33 · 390 阅读 · 0 评论 -
Codeforces Round #400 C. Molly's Chemicals
Molly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The i-th of them has affection value ai.Molly wants Sherlock to fall in love wit原创 2017-02-25 14:31:26 · 1076 阅读 · 0 评论 -
蓝桥杯 基础练习 Sine之舞 暴力
问题描述 最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功。所以他准备和奶牛们做一个“Sine之舞”的游戏,寓教于乐,提高奶牛们的计算能力。 不妨设 An=sin(1–sin(2+sin(3–sin(4+...sin(n))...) Sn=(...(A1+n)A2+n-1)A3+...+2)An+1 FJ想让奶牛们计算Sn原创 2017-02-26 16:37:30 · 1127 阅读 · 0 评论 -
CodeForces - 382C Arithmetic Progression 思维
Everybody knows what an arithmetic progression is. Let us remind you just in case that an arithmetic progression is such sequence of numbers a1, a2, ..., an of length n, that the following condition原创 2017-03-06 11:26:04 · 514 阅读 · 0 评论 -
Sheldon Numbers Gym - 101128H 思维枚举
题目链接题意:问区间[x,y]中有多少数的二进制表示是ABAB..AB型或者A型的,其中A是n个1,B是m个0,n,m>0 思路:对于这个题的话 我们知道满足条件的且在(x,y)的,那么其二进制位数肯定也在x和y所对应的二进制位数之间;所以在这里我们可以先求出x,y所对应的二进制位数,然后在这个位数区间内枚举所有满足情况的解,当然也有一些是大于y的 我们要去掉.原创 2017-03-27 22:47:48 · 707 阅读 · 0 评论 -
nyoj 1187 模拟2048
题目链接最不会水模拟来模拟....首先题目给的提示都没想明白...原来是当前的格子优先和他后面的哪一个合并(这里指全部非0),然后当前格子不动如果还能和后面合并则继续合并,不能话在往后移合并...奶奶的要不我k爷告诉我我能写一晚上也a不了思路:确实是个水模拟...首先给定一个方向合并的时候,要把格子数为0的元素,其后面的元素往前移,全部移动完我们在合并..但是注意可能后面的数字原创 2017-03-11 19:06:57 · 470 阅读 · 0 评论 -
5-12 最长对称子串 (25分) 思维
题目链接思路:这个题如果就去枚举每个子串判断其是否是对称的 复杂度太高看了网上大牛的题解,确实很巧妙的思维想法对于一个字符串我们从中间向两端去扩展并判断是否对称分为两种情况:1.如果对称子串是奇数,就以该字符为轴向两边扩展 找到一个对称的就+2最后更新最大值2.如果对称子串是偶数,那么就以两个字符为轴向两边扩展,找到对称+2 并更新最大值#includeus原创 2017-03-12 12:32:06 · 3944 阅读 · 3 评论 -
nyoj 1087 数学规律
点击打开链接思路:飞巨给我讲的,说是模拟填数,要想最大以贪心的思想就是把n*n的放在对角线上,然后到下一个对角线最近要走两步,然后继续填,然后去发现规律,(剩下最后一个对角线上的点就不填了,因为要保证按顺序)PS:我也求了一个验证代码去跑了一下#includeusing namespace std;const int maxn=1e6+10;typedef long lo原创 2017-03-12 12:45:04 · 531 阅读 · 0 评论