![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
文章平均质量分 81
mmk27
这个作者很懒,什么都没留下…
展开
-
Gym - 101972H Beautiful Substrings 思维 + 后缀和
You are given two strings a and b consisting of lowercase English letters. A beautiful substring is defined as a substring of any length of string b such that the first and last letters of it are the ...原创 2018-12-16 11:59:16 · 267 阅读 · 0 评论 -
Gym - 101911E Painting the Fence set
There is a beautiful fence near Monocarp's house. The fence consists of nn planks numbered from left to right. The ii-th plank has color aiai.Monocarp's father have decided to give his son mm orders...原创 2018-12-18 14:08:15 · 514 阅读 · 3 评论 -
Gym - 101911G Tree Reconstruction
StatementsMonocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 11 to nn. For every edge eeof this tree, Mo...原创 2018-12-18 19:56:16 · 725 阅读 · 0 评论 -
CodeForces - 500B New Year Permutation floyd+选择排序
User ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to make his permutation as pretty as possible.Permutation a1, a2, ..., an is prettier than permutation b1, b2, ..., ...原创 2018-12-18 21:43:02 · 290 阅读 · 0 评论 -
HDU - 4495 Rectangle 暴力枚举+预处理
Given a rectangle which contains N rows and each of them contains a string length of M.You must find out a symmetrical isosceles right triangle (with two equal edges and a right angle) with two edges...原创 2018-12-31 16:19:52 · 358 阅读 · 0 评论 -
CodeForces - 523C Name Quest 思维
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name fr...原创 2018-12-25 21:48:50 · 203 阅读 · 0 评论 -
牛客网 Applese 走方格
题目链接:点击查看题解:我们容易发现到当n,m都为奇数时,是回不到原点的,因为你无论哪个方向走一去一回就是两步,所以n和m必然有一个偶数,那至于我们怎么走呢,看下图,注意的是n==1,m==2时和n==2,m==1时是可以的,其他n==1或m==1是不行的 #include<bits/stdc++.h>using namespace std;typedef lon...原创 2019-01-29 17:32:50 · 284 阅读 · 0 评论 -
CodeForces - 555A Case of Matryoshkas
题目链接:点击查看题意:太他妈难懂了,大致意思就是有k条链,想得到1->2->..>n,这样的链,有两种操作,一种是断开链,需要1秒,一种是可以将1个单独的数字接在链后面,需要1秒,问最少需要多少秒题解:因为连接的时候只能一个一个连接,所以需要连接的都需要断开,从1往后连续的cnt个就不需要动了,断开n-cnt-k+1不连续的都需要重新连接上,连接的数量n-cnt,总...原创 2019-02-28 22:42:23 · 174 阅读 · 0 评论 -
CodeForces - 557C Arthur and Table 预处理 前缀
题目链接:点击查看题意:有n个桌腿,要砍掉某些桌腿,使剩下的桌腿中长度最大的桌腿的数量如果超过一半。砍掉每个桌腿需要付出代价。求最小的代价和,操蛋,砍掉的意思是直接去掉,我理解成了,可以砍去一部分使其变短,并且长度最长的超过一半没注意到,改了半天被别人提醒才知道,渣渣啊题解:因为价值最多才200,长度100000,我们可以枚举每个长度,首先长度超过的肯定要去掉,如果还需要去掉再从价值小的去...原创 2019-02-28 23:34:34 · 197 阅读 · 0 评论 -
CodeForces - 555C Case of Chocolate set pair
题目链接:点击查看题意:有一个n*n的矩形,给你对角线上的坐标,给你一个方向,问能走几个坐标,遇到之前已经经过的坐标就停止题解:当给你一个坐标(x,y),方向向上时,他能所经过的点数是受y比他大的那些点影响的,并且比y大离y最近的那个点向上能到达哪个x值,他就能到达哪个x值,如果之前有点(x1,y1)向左,那也就说明这个点没法向上了,这个点的向上临界值就为x。向左的同理是受大于x的那些点影...原创 2019-03-01 20:27:33 · 121 阅读 · 0 评论 -
CodeForces - 545A Toy Cars 水题
题目链接:点击查看Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.T...原创 2019-02-27 14:01:28 · 184 阅读 · 0 评论 -
Gym - 101911B Glider 贪心
A plane is flying at a constant height of hh meters above the ground surface. Let's consider that it is flying from the point (−109,h)(−109,h) to the point (109,h)(109,h) parallel with OxOx axis.A g...原创 2018-12-18 13:11:52 · 332 阅读 · 0 评论 -
CodeForces - 451C Predict Outcome of the Game 构造
There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played.You are an avid football fan, but recently you missed the whole k games. Fo...原创 2018-12-12 11:41:12 · 151 阅读 · 0 评论 -
Gym - 101972I Secret Project 组合数+思维
There are n students working on a secret project, this project is very important and unique, so they decided to keep it safe, and protect it from leakage.The students will put all the project's docu...原创 2018-12-16 12:14:36 · 535 阅读 · 0 评论 -
Gym - 101972J Even Numbers 规律
Yousef loves playing with functions in his free time. Today, he invents the following function:Yousef will give you a list of queries, and you need to find the answers for them. For each query, yo...原创 2018-12-16 12:28:06 · 378 阅读 · 1 评论 -
Gym - 101972G Minimax 预处理+枚举
You are given a grid consisting of n rows each of which is dived into m columns. The rows are numbered from 1 to n from top to bottom, and the columns are numbered from 1 to m from left to right. Each...原创 2018-12-16 13:01:32 · 378 阅读 · 0 评论 -
CodeForces - 459C Pashmak and Buses 构造
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different pl...原创 2018-12-11 09:52:33 · 342 阅读 · 0 评论 -
Gym - 101911A Coffee Break set保存 map标记 模拟
Recently Monocarp got a job. His working day lasts exactly mm minutes. During work, Monocarp wants to drink coffee at certain moments: there are nn minutes a1,a2,…,ana1,a2,…,an, when he is able and wi...原创 2018-12-17 17:08:07 · 218 阅读 · 0 评论 -
Gym - 101911C Bacteria
Recently Monocarp has created his own mini-laboratory!The laboratory contains nn bacteria. Monocarp knows that he can merge any two bacteria having equal sizes, and the resulting bacterium will have...原创 2018-12-17 17:13:20 · 429 阅读 · 0 评论 -
Gym - 101911K Medians and Partition 思维
Let median of some array be the number which would stand in the middle of this array if it was sorted beforehand. If the array has even length let median be smallest of of two middle elements. For exa...原创 2018-12-17 17:24:13 · 650 阅读 · 0 评论 -
HDU - 4224 Enumeration? 这是一个秦少都没看懂的题
In mathematics and theoretical computer science, the broadest and most abstract definition of an enumeration of a set is an exact listing of all of its elements (perhaps with repetition).If we are bl...原创 2018-12-23 15:03:06 · 359 阅读 · 0 评论 -
CodeForces - 1092D1 Great Vova Wall (Version 1) 思维 栈
Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.Th...原创 2018-12-23 15:51:33 · 307 阅读 · 0 评论 -
CodeForces - 1092D2 Great Vova Wall (Version 2) 思维 栈
Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.Th...原创 2018-12-23 15:55:22 · 463 阅读 · 0 评论 -
ZOJ - 2968 Difference Game 思维
题目链接:点击查看Now you are going to play an interesting game. In this game, you are given two groups of distinct integers andCcoins. The two groups, namedGaandGbrespectively, are not empty and contai...原创 2019-03-03 19:14:00 · 143 阅读 · 1 评论 -
CSL 的魔法 枚举更新
链接:https://ac.nowcoder.com/acm/contest/551/E来源:牛客网题目描述有两个长度为 n 的序列,a0,a1,…,an−1a0,a1,…,an−1和 b0,b1,…,bn−1b0,b1,…,bn−1。CSL 有一种魔法,每执行一次魔法,可以任意挑选一个序列并任意交换序列中两个元素的位置。CSL 使用若干次魔法,得到最终的序列 a 和 b,并且想要让...原创 2019-04-01 13:40:55 · 347 阅读 · 5 评论 -
Contest1786 - 2019年第二阶段我要变强个人训练赛第十场 问题 A: Kenken Race dp超车
题目链接:http://icpc.upc.edu.cn/problem.php?cid=1786&pid=0题目描述There are N squares arranged in a row, numbered 1,2,...,N from left to right. You are given a string S of length N consisting of . and...原创 2019-07-03 12:10:54 · 159 阅读 · 0 评论 -
吉首大学2019年程序设计竞赛(重现赛)
题目链接:https://ac.nowcoder.com/acm/contest/992#question链接:https://ac.nowcoder.com/acm/contest/992/A来源:牛客网A、SARS病毒时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述目...原创 2019-07-14 17:12:44 · 924 阅读 · 0 评论 -
2019 Multi-University Training Contest 1 D Vacation 思维
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6581题意:n+1辆车,每辆车有个位置,长度和速度,求第一辆车到达终点的时间题解:第一辆车肯定会以这n+1辆车的某辆车的速度到达终点,所以就枚举一下这n+1辆车,求个时间的最大值即可#include <bits/stdc++.h>using namespace std;co...原创 2019-07-22 20:34:51 · 530 阅读 · 5 评论 -
2019 杭电多校 HDU - 6614 AND Minimum Spanning Tree 思维
题目链接:https://vjudge.net/problem/HDU-6614题意:建一个树,使得权值和最小,边权为两点的 & 值题解:对于 i 这个点 假设 二进制位101,那就和2这个点链接,假设为111,那就看一下有没有8这个点,没有的话就和点1连接#include <bits/stdc++.h>using namespace std;typedef ...原创 2019-07-31 18:54:20 · 470 阅读 · 0 评论 -
2019 杭电多校 Just an Old Puzzle HDU - 6620 数字华容道有解
题目链接:https://vjudge.net/problem/HDU-6620题解:#include <bits/stdc++.h>using namespace std;int a[20];int n;int main( ) { int T; scanf("%d", &T); int flag, x, ans; while(...原创 2019-07-31 19:01:41 · 769 阅读 · 3 评论 -
2019 杭电多校 HDU - 6623 Minimal Power of Prime 因子幂最小
题目链接:https://vjudge.net/problem/HDU-6623题意:输出n,所以质因子幂的最小值题解:先处理1e4以内的质数,也就1000多个,然后如果没有除尽的话,因子最多也就4个了,所以幂数大于1的情况有p1^4,p1^3, p1^2 , p1^2*p2^2, 对于其他情况肯定有幂为1的。#include<cstdio>#include<c...原创 2019-07-31 19:11:29 · 1080 阅读 · 8 评论 -
2019 HDU多校 HDU - 6586 String 贪心
题目链接:https://cn.vjudge.net/problem/HDU-6586题意:给出一个序列,找到长度为k的字典序最小的子序列,并且给出每个字符的数量的限制题解:这个和计蒜客复赛的题很像,链接:https://blog.csdn.net/mmk27_word/article/details/92417741,但是这个给出了每个字符数量的限制,那么我们就预处理记录下每个位置后面每...原创 2019-07-23 12:56:42 · 233 阅读 · 0 评论 -
2019杭电多校第7场 Final Exam HDU - 6651 思维
题目链接:https://vjudge.net/problem/HDU-6651题解:换位思考, 考虑如果我们是出题人会怎么让学生做不出 k 题, 即最坏情况.显然, 我们会挑出学 生复习得最少的 n−k + 1 道题, 让每道题的难度都等于他复习的时间.(田忌赛马的策略) 因此, 回到学生视角, 我们要让自己复习的最少的 n−k + 1 题复习时间总和 > m, 构造方式显 然。剩下的...原创 2019-08-13 20:24:41 · 458 阅读 · 0 评论 -
2019牛客暑期多校训练营(第十场)B、Coffee Chicken 思维模拟
链接:https://ac.nowcoder.com/acm/contest/890/B来源:牛客网Coffee Chicken时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述Dr. JYY has just created the Coffee Chicken str...原创 2019-08-17 21:14:21 · 197 阅读 · 0 评论 -
CodeForces - 1208C Magic Grid 构造
题目连接:https://cn.vjudge.net/problem/CodeForces-1208C题解:因为都是4的倍数,想到二进制位的话应该是每四位一个整体,比如0-15,前两位表示行,后两位表示列,就能得到:0 1 2 34 5 6 78 9 10 1112 13 14 15这样异或结果都是0,然后每4*4的一个整体都这么赋值#include <bits/st...原创 2019-08-26 13:13:12 · 769 阅读 · 0 评论 -
Contest1786 - 2019年第二阶段我要变强个人训练赛第十场 问题 B: ABC 思维
题目链接:http://icpc.upc.edu.cn/contest.php?cid=1786题目描述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 conti...原创 2019-07-03 11:17:55 · 175 阅读 · 0 评论 -
Contest1789 - 2019年第二阶段我要变强个人训练赛第十二场 问题 B: Balanced Neighbors 构造
题目描述You are given an integer N. Build an undirected graph with N vertices with indices 1to N that satisfies the following two conditions:·The graph is simple and connected.·There exists an intege...原创 2019-07-08 09:35:48 · 198 阅读 · 0 评论 -
CSL 的拼图 枚举更新
链接:https://ac.nowcoder.com/acm/contest/551/H来源:牛客网题目描述众所周知 CSL 不仅玩魔方很强,打麻将也很强。今天他打魔法麻将的时候,在路上撞到了一个被打乱的 n 维魔法拼图。每一块拼图的位置用一个 n 维的坐标 (p1,p2,…,pn)(p1,p2,…,pn) 来表示。将拼图的任意两块交换位置称为一步。CSL 赶着打魔法麻将时间很...原创 2019-04-01 15:05:29 · 345 阅读 · 0 评论 -
FZU - 2202 犯罪嫌疑人 枚举判断 思维
题目链接:点击查看题意:福尔摩斯是个大侦探,他总是在解决疑难案件。这一次的案件也不例外,案件是这样的:有编号为1到N的N位嫌疑犯,他们其中有一个犯了罪,然后每个嫌疑犯都被询问,“哪一个人犯了罪?”犯罪嫌疑人的答案只能“编号ai的嫌疑犯犯了罪”或者“编号ai的嫌疑犯没有犯罪”。当然嫌疑犯也可以说他自己(ai = i).福尔摩斯凭着他敏锐的侦探直觉,确定地对华生说,只有M个人说了真话,其余...原创 2019-04-03 19:13:04 · 178 阅读 · 0 评论 -
HDU - 6492 分宿舍 暴力
题目链接:点击查看Problem Description“那天TA说TA要来,于是我就来啦。那天我说我要来,于是你就来啦。TA看到了什么?你又看到了什么?我看到你们在一起,我是真的很happy:)太阳在哪里啊?就在早上七八点。太阳在哪里啊?就在云的栖息地!”——2050主题曲2050的线下活动吸引了很多心怀梦想的年轻人。小伙们打算组团去参加。他们一共有 n+m+2k ...原创 2019-04-16 13:04:34 · 987 阅读 · 0 评论