![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
Charon_HN
NLP炼丹儿
展开
-
Largest Rectangle (单调栈,同POJ2559)
题目链接题意:题意:给你宽度为一,高度不同的n个矩形,让求出一个最大面积的矩形。如下图所示分析:方法一:根据题意可知,若以h为起点,分别往两边找比h矮的矩形,此时比h矮的前一个组成的矩形便是能围成的最大面积;上述有一些意识流,看代码比较好理解#include <iostream>#include <cmath>#include <algorithm>#include <queue>#include <vector>#in原创 2021-02-03 20:36:51 · 76 阅读 · 0 评论 -
2019牛客暑期多校训练营(第九场) All men are brothers 并查集+思维
[All men are brothers](https://ac.nowcoder.com/acm/contest/889/E)样例1:6 61 23 44 53 53 62 4输出:15940000样例2:100000 0输出4166416671249975000题意:n个人,m个相互认识的关系,问从n个人中选择4个人,使其相互不认识的方案是多...原创 2019-08-19 11:05:41 · 246 阅读 · 0 评论 -
HDU 2451 找规律 2008哈尔滨现场赛
题目链接题目描述A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening pa...原创 2019-08-06 21:39:15 · 402 阅读 · 0 评论 -
2019牛客暑期多校训练营(第四场) K题 number
题目描述300iq loves numbers who are multiple of 300.One day he got a string consisted of numbers. He wants to know how many substrings in the string are multiples of 300 when considered as decimal integ...原创 2019-07-27 21:56:55 · 356 阅读 · 0 评论 -
Minimal Power of Prime HDU - 6623 2019 Multi-University Training Contest 4
Minimal Power of PrimeYou are given a positive integer n > 1. Consider all the different prime divisors of n. Each of them is included in the expansion n into prime factors in some degree. Require...原创 2019-08-01 15:12:51 · 113 阅读 · 0 评论 -
2019牛客暑期多校训练营(第三场) B题
Crazy Binary String题意:给你一个长度为n的01字符串,问该字符串中01个数相等的最长子串和子序列分别是多少。分析:首先,大家要知道什么是子序列,什么是子串,子序列是不一定是连续的,它可以是原串中任意元素按照相对位置组成的序列,但是子串就不是了,子串一定是连续的,不可分割的按照绝对位置组成的序列。知道这个概念之后,大家可以明显的看出,子序列这个答案好求,就是暴力一下,...原创 2019-07-25 20:57:21 · 596 阅读 · 0 评论 -
2019牛客暑期多校训练营(第二场)
Second Large Rectangle题目大意:给你一个N*M的01矩阵,问这个矩阵中存在的第二大的矩形面积是多少,要求矩形是由全1 组成的,注意,如果只存在一个这样的矩形,那么就输出0分析:算是提供一个思路吧,定义一个二维数组,通过这个二维数组来记录每一列连续的1的个数,然后再去枚举列#include<iostream>#include<cstdio>...原创 2019-07-25 17:00:15 · 189 阅读 · 0 评论 -
Contest1800 - 2019年第二阶段我要变强个人训练赛第十七场 czr 太弱啦
UPC题解题目描述czr太弱啦!他现在小学组题目都不会做,于是来求助你。问题是:给定一棵树,问路径的异或和等于k的有几条?形式化描述:给定一棵N个节点组成的有边权的无根树,你需要计数这样的正整数对(u,v)(1≤u≤v≤n),满足若从u到v经过的路径上的边权依次为w1,w2,…,wL,那么w1 xor w2 xor…xor wL =k。其中“xor”表示非负整数按位取异或。输入第1行:...原创 2019-07-29 20:53:03 · 107 阅读 · 0 评论 -
求1~N 的数中因子是最多的数及其最多的个数
【问题描述】求1~N当中约数个数最多的数的个数。【输入格式】T组数据每一组只有一行。这一行有一个数N(1≤N<10^18)。simple input31391000000000000000000simple output139103680分析:直接暴力肯定会超时,那么怎么处理呢???根据唯一分解定理,我们可以知道一个整数是可以分解成素数的乘积的那么就可以得到...原创 2019-05-26 20:20:21 · 2590 阅读 · 0 评论 -
2019牛客暑期多校训练营(第九场) Symmetrical Painting (类似扫描)
题目链接样例1:31 54 72 3输出:4题意:给你n个矩形,每个矩形的左下端点和右上端点根据题目给出的格式给出,然后问这n个矩形所能构成的关于某一平行于x轴的直线对称的面积最大是多少;分析:emmmmm,关于某一平行于x轴的直线对称??模拟一下,发现矩形的中心轴是个分界点,什么意思呢?从矩形的下边界开始,往上边界开始枚举那个对称轴,就会发现,所求的面积是递增的...原创 2019-08-19 17:31:35 · 248 阅读 · 0 评论 -
2019牛客暑期多校训练营(第八场) B Beauty Values
题目描述Gromah and LZR have entered the second level. There is a sequence a_1, a_2, \cdots, a_na1,a2,⋯,an on the wall.There is also a note board saying “the beauty value of a sequence is the number o...原创 2019-08-10 21:04:42 · 294 阅读 · 0 评论 -
Contest1906 - 2019秋个人训练赛4 THE STAR KNOWS 将关系的判断通过建图去解决
这道题 是泉州市OJ上的题目,可能发不了链接,我就直接复制题目了。有n 个人参加Revue,她们之间共进行了m 场比赛如果在某场比赛中a 击败了b,那么a 可能胜过b如果a 可能胜过b,b 可能胜过c,那么a 可能胜过c如果x 可能胜过y,y 也可能胜过x,那么x 和y 是旗鼓相当的但如果x 可能胜过y 不满足,y 可能胜过x 也不满足,那么x 和y 不是旗鼓相当的可以发现,如果a 和...原创 2019-09-28 17:32:31 · 361 阅读 · 0 评论 -
CodeForces - 1114C n的阶乘用m进制表示末尾零的个数
Trailing Loves (or L’oeufs?)The number “zero” is called “love” (or “l’oeuf” to be precise, literally means “egg” in French), for example when denoting the zero score in a game of tennis.Aki is fond ...原创 2019-09-20 21:21:23 · 557 阅读 · 0 评论 -
HDU - 6705 K短路(无源点) 2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛
pathYou have a directed weighted graph with n vertexes and medges. The value of a path is the sum of the weight of the edges you passed. Note that you can pass any edge any times and every time you ...原创 2019-08-26 21:28:29 · 596 阅读 · 0 评论 -
2019牛客暑期多校训练营(第九场) A The power of Fibonacci 斐波那契循环节
题目链接分析:首先,我们要知道fibonacci序列模n的话是有一个循环节的存在,那对于题目这样的fibonacci也同样是有循环节的存在;我们知道Fibonacci数列,现在我们来求一个Fib数模n的循环节的长度。对于一个正整数n,我们求Fib数模n的循环节的长度的方法如下:(1)把n素因子分解,即n=p1^a1*p2^a2……pk^ak(2)分别计算Fib数模每个p^m的循...原创 2019-08-22 17:03:47 · 256 阅读 · 0 评论 -
2019牛客暑期多校训练营(第九场) D Knapsack Cryptosystem 折半查找
sample input1:8 1129295 592 301 14 28 353 120 236sample out1:01100001sample input2:36 687194767351 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 10485...原创 2019-08-17 09:53:24 · 236 阅读 · 0 评论 -
2019 Multi-University Training Contest 7 HDU - 6651 Final Exam (构造)
Final ExamFinal Exam is coming! Cuber QQ has now one night to prepare for tomorrow’s exam.The exam will be a exam of problems sharing altogether m points. Cuber QQ doesn’t know about the exact distr...原创 2019-08-13 10:06:27 · 314 阅读 · 0 评论 -
2019牛客暑期多校训练营(第八场) C CDMA 构造题
1 11 -1原创 2019-08-11 12:09:36 · 215 阅读 · 0 评论 -
2019 Multi-University Training Contest 8 HDU 6667 Roundgod and Milk Tea
Roundgod and Milk TeaRoundgod is a famous milk tea lover at Nanjing University second to none. This year, he plans to conduct a milk tea festival. There will be n classes participating in this festiv...原创 2019-08-15 09:15:27 · 236 阅读 · 0 评论 -
Greatest Common Divisor 2018CCPC桂林站G题解 备战省赛组队训练赛第十七场
题目描述There is an array of length n, containing only positive numbers.Now you can add all numbers by 1 many times. Please find out the minimum times you need to perform to obtain an array whose greate...原创 2019-05-03 18:06:22 · 432 阅读 · 1 评论 -
备战省赛组队训练赛第十六场 Winner Winner
题目描述The FZU Code Carnival is a programming competetion hosted by the ACM-ICPC Training Center of Fuzhou University. The activity mainly includes the programming contest like ACM-ICPC and strive to pr...原创 2019-05-03 09:00:00 · 300 阅读 · 0 评论 -
POJ 3169 差分约束
Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are s...原创 2018-09-02 16:36:46 · 126 阅读 · 0 评论 -
HDU1257 最少拦截系统 (最长上升子序列Dilworth定理/贪心)
某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统...原创 2018-09-07 20:04:35 · 684 阅读 · 0 评论 -
HDU 3416 关于求一个图中最短路的条数问题(即最短路的唯一性) 网络最大流的具体应用
Marriage Match IVDo not sincere non-interference。 Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls are in city B. Every t...原创 2018-09-01 18:19:15 · 780 阅读 · 0 评论 -
code forces 1029C区间删除求最大区间长度值
You are given nn segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in each ot...原创 2018-08-29 14:07:31 · 465 阅读 · 0 评论 -
POJ-3660 Floyed解决传递闭包
Cow ContestN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rati...原创 2018-08-24 14:20:43 · 184 阅读 · 0 评论 -
POJ3159 用最短路解决差分约束问题
vCodersPOJ3159(最短路)CandiesTime Limit: 1500MS Memory Limit: 131072K Total Submissions: 27051 Accepted: 7454 DescriptionDuring the kindergarten days, flymouse was the monitor...原创 2018-08-28 18:05:33 · 284 阅读 · 0 评论 -
codeforces 1025 C 字符串翻转
C. Plasticine zebratime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIs there anything better than going to the zoo after a tiresom...原创 2018-08-20 15:26:13 · 383 阅读 · 0 评论 -
codeforce 994c 思维题
http://codeforces.com/problemset/problem/994/C给你两个正方形 的四个顶点,让你求是否两者有交点用set来维护所有在正方形里面的点,这样看两个set里面是否有相同的点,如果有不就是相交了 #include<bits/stdc++.h>using namespace std;const int mod =1e9+7;type...原创 2018-08-13 15:17:16 · 404 阅读 · 0 评论 -
Codeforce 985B 思维题开关灯问题
B. Switches and Lampstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n switches and m lamps. The i-th switch turns...原创 2018-09-11 16:25:37 · 686 阅读 · 0 评论 -
最大乘积 YTU3283
3283: 最大乘积题目描述对于n个数,从中取出m个数,如何取使得这m个数的乘积最大呢?输入第一行一个数 代表数据组数每组数据共两行第一行两个正整数n、m, n,m<=20第二行给出n个整数,其中每个数的绝对值小于4 输出每组数据输出1行,为最大的乘积样例输入15 51 2 3 4 2样例输出48先将所给的数据从小到大排一下,如...原创 2018-09-03 18:37:08 · 148 阅读 · 0 评论 -
ZCMU 1985:小C的数学问题(线段树+分治)或者 栈的实现
Problem Description小C是个云南中医学院的大一新生,在某个星期二,他的高数老师扔给了他一个问题。让他在1天的时间内给出答案。但是小C不会这问题,现在他来请教你。请你帮他解决这个问题。有n个数,每个数有权值。数学老师定义了区间价值为区间和乘上区间内的最小值。现在要你找出有最大区间价值的区间是什么,并输出区间价值。Input每个输入文件只包含单组数据。...原创 2019-04-04 22:13:20 · 182 阅读 · 0 评论 -
UPC 2780 拓扑排序
题目描述Once upon a time, there arose a huge discussion among the dwarves in Dwarfland. The government wanted to introduce an identity card for all inhabitants.Most dwarves accept to be small, but they ...原创 2018-10-08 17:32:44 · 127 阅读 · 0 评论 -
Codeforce 593A 思维+枚举字符
A. 2Chartime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndrew often reads articles in his favorite magazine 2Char. The main fea...原创 2018-09-27 14:33:59 · 272 阅读 · 0 评论 -
UPC 9312 vector 当做二维数组
The ICPC-World is the most popular RPG game for ACM-ICPC contestants, whose objective is to conquer the world. A map of the game consists of several cities. There is at most one road between a pair of...原创 2018-10-04 19:11:34 · 194 阅读 · 0 评论 -
HDU5514 变形巧妙运用容斥定理
There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1m−1 and the frogs are numbered from 11 to nn. The ii-th frog can jump over exactly aia...原创 2018-10-02 18:04:24 · 188 阅读 · 0 评论 -
YTU 3292 最小删除数目使差最小
3292: 线上的点题目描述有n个整数和一个整数d(1 ≤ n ≤ 100, 0 ≤ d ≤ 100) ,现在要使得这n个数中任意两个数的差值不大于d,问至少要删除几个数。输入第一行:n,d 输入整数的个数以及n个整数之间的最大差值。第二行:n个整数xi(1<=xi<=100)。 输出至少要删除的数的个数。样例输入3 12 1 4样例输出...原创 2018-09-10 20:28:20 · 241 阅读 · 0 评论 -
POJ3279 二进制的搜索
FliptileFarmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M× N grid (1 ≤ M ≤ 15; 1...原创 2018-09-06 18:23:02 · 224 阅读 · 0 评论 -
POJ 1952 求最长下降子序列的长度和个数
The advice to "buy low" is half the formula to success in the bovine stock market.To be considered a great investor you must also follow this problems' advice: "Buy low; buy low...原创 2018-09-09 11:40:31 · 1571 阅读 · 0 评论 -
codeforces 1017B
B. The Bitstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRudolf is on his way to the castle. Before getting into the castle, t...原创 2018-08-15 20:52:23 · 168 阅读 · 0 评论