![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
永夜莫明
菜是原罪
展开
-
Powers Of Two(二进制拆分)
题目链接:http://codeforces.com/contest/1095/problem/CExamplesinput9 4outputYES1 2 2 4input8 1outputYES8input5 1outputNOinput3 7outputNO题意:n能否拆成k个2的整数次方相加,如果能输出YES以及一种拆法,否则输出NO思路:先找出n...原创 2018-12-28 01:49:23 · 1084 阅读 · 0 评论 -
ak爷走格子
ak爷走格子Description 众所周知,ak爷ljx在计科是个人物。。有一天他在玩游戏,就是操作一个机器人上下左右动的游戏。机器人一开始在(0,0)点,经过任意轮的命令之后,问是不是可以走到目标点(当然也不一定非得要走完一整串命令)。ljx很懒,你能帮他看看能否到达目标点吗?命令有四个,分别是‘U’,‘D’,‘L’,‘R’。U代表往上走:(x, y) → (x, y+1)...原创 2019-01-01 20:53:35 · 208 阅读 · 0 评论 -
POJ-1840 Eqs (5元3次方程整数解的个数)
Consider equations having the following form: a1x1 3+ a2x2 3+ a3x3 3+ a4x4 3+ a5x5 3=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution a system (x1, x2, x3...原创 2019-01-16 21:31:46 · 1177 阅读 · 0 评论 -
不吃草的灰太郎
不吃草的灰太郎Description 小学奥数题有一个经典的题目:xjy带着一匹狼,一只羊和一捆草过河,河里有一艘船,船每次可以载一个人和一个物品,且只有xjy会划船。xjy希望把所有物品通过船送到对岸,但是当xjy不在时,狼会吃羊,羊会吃草,狼不会吃草。问怎样能把所有物品送到对岸。聪明的你显然已经对这个问题的答案了如指掌,为了防止你拿到更多的气球,现在将问题升级:现在,xjy...原创 2019-01-18 17:48:17 · 574 阅读 · 0 评论 -
唐纳德先生与 .DOC
唐纳德先生与 .DOC题目链接:https://acm.ecnu.edu.cn/contest/126/problem/D/单测试点时限: 6.0 秒内存限制: 1024 MB去年夏天的时候,唐纳德先生就注意到学校饮水机上挂了一个新的牌子:天热冷水需求量大。当时他还不以为意,这不过是一个普通的牌子。于是,天冷了。有一天他注意到牌子上面新增了一个交换的记号。原来,现在牌子要改成「天冷...原创 2019-01-19 19:58:02 · 321 阅读 · 0 评论 -
Strongly Connected City (判断是否是强连通图)(菜鸡暴搜版)
题目链接:http://codeforces.com/contest/475/problem/BImagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor ...原创 2019-01-19 21:42:38 · 333 阅读 · 0 评论 -
MUH and Important Things (非递减排序)
题目链接:http://codeforces.com/problemset/problem/471/BIt's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, ...原创 2019-01-19 22:24:28 · 158 阅读 · 0 评论 -
easy problem(思维+枚举)
easy problemDescription 给你一个数字N,N的范围是1~1000000,求一个最小的正整数M,这个数字M的各个位的数字加上它本身之和恰好为N。当然,如果没有解,输出0。Input输入数据由多组数据组成,每行由一个数字N组成(1<=N<=1000000)。Output对于每组数据,输出仅一行包含一个整数M。如果对于每个N,存在最小的M,则...原创 2019-01-20 12:20:24 · 400 阅读 · 0 评论 -
MUH and House of Cards (找规律+枚举)
题目链接:http://codeforces.com/problemset/problem/471/CPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For tha...原创 2019-01-20 13:13:19 · 245 阅读 · 0 评论 -
小a与204(思维,找规律,贪心)
链接:https://ac.nowcoder.com/acm/contest/317/B来源:牛客网复制粘贴可能有问题,可以点链接看题目描述 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述小a非常喜欢204204这个数字,因为′a′+′k′=204。现在他有一个长度为nn的...原创 2019-01-27 22:32:30 · 163 阅读 · 0 评论 -
Plus and Square Root (找规律,思维,构造)
题目链接:http://codeforces.com/problemset/problem/715/AZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '' (square root). Initially, ...原创 2019-02-17 16:57:40 · 292 阅读 · 0 评论 -
K倍区间(前缀和+思维)
题目描述给定一个长度为N的数列,A1, A2, ... AN,如果其中一段连续的子序列Ai, Ai+1, ... Aj(i <= j)之和是K的倍数,我们就称这个区间[i, j]是K倍区间。 你能求出数列中总共有多少个K倍区间吗? 输入第一行包含两个整数N和K。(1 <= N, K <= 100000) 以下N行每行包含一个整数Ai。(1 <=...原创 2019-02-24 14:42:22 · 355 阅读 · 0 评论 -
分割平面,分割空间类题目总结
转自:https://www.cnblogs.com/chaosheng/archive/2012/01/26/2329583.html(1) n条直线最多分平面问题题目大致如:n条直线,最多可以把平面分为多少个区域。析:可能你以前就见过这题目,这充其量是一道初中的思考题。但一个类型的题目还是从简单的入手,才容易发现规律。当有n-1条直线时,平面最多被分成了f(...转载 2019-03-04 18:27:58 · 503 阅读 · 0 评论 -
不容易系列之(3)—— LELE的RPG难题
人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即"可乐"),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法.以上就是著名的RPG难...原创 2019-03-04 19:28:21 · 325 阅读 · 0 评论 -
Maximize Sum of Digits(思维)
题目链接:http://codeforces.com/contest/770/problem/BAnton has the integerx. He is interested what positive integer, which doesn't exceedx, has the maximum sum of digits.Your task is to help Anton an...原创 2019-03-11 00:27:55 · 244 阅读 · 0 评论 -
Nim (nim博弈+前缀异或和+思维)
Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. The game ends when one of the players is unable to remove object in his/her turn. This play...原创 2019-03-12 23:58:28 · 1307 阅读 · 0 评论 -
FZU2202 犯罪嫌疑人(逻辑推理+模拟)
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2202福尔摩斯是个大侦探,他总是在解决疑难案件。这一次的案件也不例外,案件是这样的:有编号为1到N的N位嫌疑犯,他们其中有一个犯了罪,然后每个嫌疑犯都被询问,“哪一个人犯了罪?”犯罪嫌疑人的答案只能“编号ai的嫌疑犯犯了罪”或者“编号ai的嫌疑犯没有犯罪”。当然嫌疑犯也可以说他自己(ai = i).福尔...原创 2019-04-03 10:42:40 · 291 阅读 · 0 评论 -
危险系数(思维+DFS)
危险系数 抗日战争时期,冀中平原的地道战曾发挥重要作用。 地道的多个站点间有通道连接,形成了庞大的网络。但也有隐患,当敌人发现了某个站点后,其它站点间可能因此会失去联系。 我们来定义一个危险系数DF(x,y): 对于两个站点x和y (x != y), 如果能找到一个站点z,当z被敌人破坏后,x和y不连通,那么我们称z为关于x,y的关键点。相应的,对于任意一对...原创 2019-04-05 13:18:07 · 209 阅读 · 0 评论 -
Ilya and a Colorful Walk(思维)
题目链接:http://codeforces.com/contest/1119/problem/AIlya lives in a beautiful city of Chordalsk.There arenhouses on the street Ilya lives, they are numerated from1tonfrom left to right; the dis...原创 2019-04-07 10:25:14 · 239 阅读 · 0 评论 -
小蚂蚁过马路(思维)
链接:https://ac.nowcoder.com/acm/contest/642/H来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述共 有 n(1<=n<=1e15) 只 小 蚂 蚁 准 备 从 城 市 1 穿 梭 到 城 市 K(1<=K&...原创 2019-04-21 14:53:02 · 399 阅读 · 0 评论 -
Strings in the Pocket (思维+manacher)
题目链接:https://cn.vjudge.net/problem/ZOJ-4110题意:给你两个串,可以翻转s串的一个区间,问有多少对l,r使得翻转后的s串等于t串思路:当s串和t串相同的时候,跑一遍马拉车,有多少回文串就有多少种 当s串和t串不同的时候,就更简单了当s和t只有1个字符不同时,无论怎么翻转都不可能相同,0种 当s和t有2个及以上字符不同时,先找出左边第一个不同...原创 2019-04-29 20:12:36 · 176 阅读 · 0 评论 -
2018CCPC吉林C-JUSTICE(思维模拟)
Put simply, the Justice card represents justice, fairness, truth and the law. You are being called to account for your actions and will be judged accordingly. If you have acted in a way that is in ali...原创 2019-05-03 16:43:20 · 1234 阅读 · 1 评论 -
Little Sub and Enigma(思维模拟)
题目描述Little Sub builds a naive Enigma machine of his own. It can only be used to encrypt/decrypt lower-case letters by giving each letter a unique corresponding lower-case letter. In order to ensure ...原创 2019-05-04 14:47:42 · 355 阅读 · 0 评论 -
Just Random(思维+数学找规律+容斥)
题目链接:https://cn.vjudge.net/problem/HDU-4790Coach Pang and Uncle Yang both love numbers. Every morning they play a game with number together. In each game the following will be done: 1. Coach Pang ...原创 2019-07-02 16:56:11 · 528 阅读 · 0 评论 -
ABC(思维)
题目描述You are given a string s consisting of A, B and C.Snuke wants to perform the following operation on s as many times as possible:Choose a contiguous substring of s that reads ABC and replace it...原创 2019-07-03 18:16:16 · 274 阅读 · 0 评论 -
滑稽树下你和我(树+贡献)
链接:https://ac.nowcoder.com/acm/contest/992/J?&headNav=acm来源:牛客网题目描述红红和蓝蓝是随机降生在苹果树上的苹果仙灵,现在红线仙想估测他们的CP系数,并决定是否使他们成为一对CP。给出n个结点n-1条边的树,节点编号为1到n,定义distance(i,j)为i与j的树上距离。CP系数是指所有红红和蓝蓝在不同位置i,j的d...原创 2019-07-14 20:48:44 · 304 阅读 · 0 评论 -
String painter(区间dp,好题难题)
https://cn.vjudge.net/problem/HDU-2476There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the pa...原创 2019-07-18 00:56:16 · 798 阅读 · 0 评论 -
String(有限制的序列自动机?)
http://icpc.upc.edu.cn/problem.php?cid=1822&pid=8题目描述Tom has a string containing only lowercase letters. He wants to choose a subsequence of the string whose length is k and lexicographical or...原创 2019-07-22 21:24:56 · 166 阅读 · 1 评论 -
Subarray(思维+模拟+lazy标记+……)
https://ac.nowcoder.com/acm/contest/882/J当时开局ac率100%,然后就死磕这道题(主要是因为题目短,不想去读别的题),一发RE,一发MLE,然后放弃了……WJYTXDY当时的想法很朴素,就是对于每一个位置的前缀和,看在他左边比他小的前缀和的数量(很明显时间复杂度不行,k*1e9,当时抱着如果评测机跑的快的话,说不定……),因为有负数,所以加...原创 2019-07-23 21:21:55 · 156 阅读 · 0 评论 -
无聊游戏(博弈+思维+数学推导+模糊模拟)
问题 B: 无聊游戏问题 B: 无聊游戏时间限制: 1 Sec内存限制: 128 MB提交: 96解决: 18[提交] [状态] [命题人:admin]题目描述小N和小A在玩这样的一个游戏:给定初始数列Q,小N先把某个前缀(可以为空)的数字全部乘上−A,小A再把某个后缀(可以为空)的数字全部乘上−B,小N想让最后所有数的和尽量大,而小A想让最后所有数的和尽量的小。...原创 2019-07-31 19:48:27 · 287 阅读 · 0 评论 -
All-one Matrices(单调栈+思维)
链接:https://ac.nowcoder.com/acm/contest/888/A来源:牛客网题目描述Gromah and LZR entered the great tomb, the first thing they see is a matrix of size n×mn\times mn×m, and the elements in the matrix are all...原创 2019-08-12 23:15:02 · 386 阅读 · 0 评论 -
Shashlik Cooking(思维题)
https://cn.vjudge.net/problem/CodeForces-1040BLong story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: in...原创 2019-08-17 23:24:27 · 256 阅读 · 0 评论 -
2019百度之星初赛第二场 度度熊与运算式1
思路:1之间的异或要么是0,要么是1,那么最终结果二进制上的1(除了最后一个2^0=1),一定是通过加法得到的,每个1只构造一次,多了可能就被异或掉了关键是考虑2^0=1这个1怎么造,假设这个1是通过+得到的,那么最后要想留住这个1,剩下用来异或的1的个数必须是偶数个,既然是这样,那么这个1我不加上,剩下的1的个数是奇数个,通过异或我也能把这个1造出来,所以就不用管它了...原创 2019-08-18 21:32:06 · 478 阅读 · 0 评论 -
Anna, Svyatoslav and Maps(思维+folyd求最短路)
http://codeforces.com/contest/1204/problem/CThe main characters have been omitted to be short.You are given a directed unweighted graph without loops withnnvertexes and a path in it (that path i...原创 2019-08-22 01:07:37 · 454 阅读 · 7 评论 -
Queue (单调序列+二分)
https://cn.vjudge.net/problem/CodeForces-91BThere arenwalruses standing in a queue in an airport. They are numbered starting from the queue's tail: the1-st walrus stands at the end of the queue a...原创 2019-08-22 20:47:05 · 346 阅读 · 0 评论 -
Uniqueness(思维+模拟)
https://codeforces.com/contest/1208/problem/BB. UniquenessYou are given an arraya1,a2,…,an. You can removeat most onesubsegment from it. The remaining elements should be pairwise distinct.In ...原创 2019-08-26 19:42:40 · 294 阅读 · 5 评论 -
Restore Permutation(思维+线段树)
https://codeforces.com/contest/1208/problem/DD. Restore Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array of...原创 2019-08-27 01:30:44 · 736 阅读 · 0 评论