![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法设计与分析
文章平均质量分 91
Pandapan1997
学习
展开
-
杜教BM模板(仅适用于线性递推式)
据说这个模板可以解决任何线性递推式,听说是杜教的,只要我们手推递推式的前几项,然后扔进这个板子就可以求出后面的,前几项推得越多越好,准确率越高。、#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <vector>#...原创 2019-05-08 21:11:04 · 443 阅读 · 0 评论 -
C++STL库用法总结(set,map,priority_queue)
最近整理了一下C++总常用的STL,由于匆忙,如有错误,欢迎指正。优先队列 priority_queue关于优先队列,它的实现就是数据结构的大顶堆跟小顶堆,如有疑问可自行百度,不在做说明。优先队列的基本用法跟队列没什么两样,不同的是queue的取队首元素为q.front()而priority_queue是q.top(),并且优先队列可以根据自定义来实现队列中元素的排序,其原理就是利用堆...原创 2019-03-20 17:14:17 · 951 阅读 · 0 评论 -
问题 I: Slot Machine()KMP找最小循环节)
9318: Slot Machines时间限制: 1 Sec 内存限制: 128 MB提交: 191 解决: 49[提交] [状态] [讨论版] [命题人:admin]题目描述Slot machines are popular game machines in casinos. The slot machine we are considering has six places...原创 2018-10-05 09:33:41 · 401 阅读 · 0 评论 -
Gym - 101667B Connect3 [DFS 模拟]
问题 B: Connect3时间限制: 1 Sec 内存限制: 256 MB提交: 39 解决: 16[提交] [状态] [讨论版] [命题人:admin]题目描述Connect3 is a simplified version of a well-known Connect4 game. Connect3 is a game for two players, black an...原创 2018-10-04 21:33:01 · 375 阅读 · 0 评论 -
7710: MicroRNA Ranking(拓扑排序+优先队列)
7710: MicroRNA Ranking时间限制: 2 Sec 内存限制: 128 MB提交: 121 解决: 40[提交] [状态] [讨论版] [命题人:admin]题目描述Ahlaam is a computer science student, doing her master thesis on a bioinformatics project about Mic...原创 2018-09-08 09:45:49 · 174 阅读 · 0 评论 -
Partial Order Relation(素数分解)
问题 H: A Partial Order Relation时间限制: 1 Sec 内存限制: 128 MB提交: 93 解决: 24[提交] [状态] [讨论版] [命题人:admin]题目描述In mathematics, a partial order set formalizes and generalizes the intuitive concept of an o...原创 2018-08-27 20:34:25 · 655 阅读 · 0 评论 -
Sum of the Line UPC5222 (容斥)
莫过一日曝十日寒。5222: Sum of the Line时间限制: 1 Sec 内存限制: 128 MB提交: 212 解决: 61[提交] [状态] [讨论版] [命题人:admin]题目描述Consider a triangle of integers, denoted by T. The value at (r, c) is denoted by Tr,c , w...原创 2018-08-23 11:42:42 · 237 阅读 · 0 评论 -
ACM-ICPC 2017 Asia Urumqi:A. Coins(概率DP+组合数学)
问题 A: Coins I题目描述Alice and Bob are playing a simple game. They line up a row of n identical coins, all with the heads facing down onto the table and the tails upward.For exactly m times they sele...原创 2018-08-23 10:15:29 · 296 阅读 · 0 评论 -
p1m2 题解 2018 “百度之星”程序设计大赛 - 初赛(B)(二分)
2018百度之星复赛晋级名单出炉(增加20%晋级名额)~ p1m2 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 757 Accepted Submission(s): 282 ...原创 2018-08-13 10:53:34 · 595 阅读 · 0 评论 -
洛谷 P4454 [CQOI2018]破解D-H协议
题目背景Diffie-Hellman密钥交换协议是一种简单有效的密钥交换方法。它可以让通讯双方在没有事先约定密钥(密码) 的情况下,通过不安全的信道(可能被窃听) 建立一个安全的密钥K,用于加密之后的通讯内容。题目描述假定通讯双方名为Alice和Bob,协议的工作过程描述如下(其中 mod 表示取模运算) : 协议规定一个固定的质数P,以及模P 的一个原根g。P 和g 的数值都是...原创 2018-08-12 12:56:23 · 310 阅读 · 0 评论 -
bzoj 5088: HDU 6000 Wash(思维+优先队列)
6910: 洗衣服时间限制: 2 Sec 内存限制: 128 MB提交: 94 解决: 31[提交] [状态] [讨论版] [命题人:admin]题目描述你现在要洗L件衣服。你有n台洗衣机和m台烘干机。由于你的机器非常的小,因此你每次只能洗涤(烘干)一件衣服。第i台洗衣机洗一件衣服需要wi分钟,第i台烘干机烘干一件衣服需要di分钟。请问把所有衣服洗干净并烘干,最少需要多少时间...原创 2018-08-09 10:34:29 · 231 阅读 · 0 评论 -
6759: 异或序列 UPC (莫队算法)
6759: 异或序列时间限制: 1 Sec 内存限制: 128 MB提交: 160 解决: 67[提交] [状态] [讨论版] [命题人:admin]题目描述已知一个长度为n的整数数列a1,a2,…,an,给定查询参数l、r,问在al,al+1,…,ar区间内,有多少子序列满足异或和等于k。也就是说,对于所有的x,y(l≤x≤y≤r),满足ax⊕ax+1⊕⋯⊕ay=k的x,y有...原创 2018-08-08 10:16:22 · 289 阅读 · 0 评论 -
UPC-6603: ConvexScore(思维转换题)
6603: ConvexScore时间限制: 1 Sec 内存限制: 128 MB提交: 87 解决: 43[提交] [状态] [讨论版] [命题人:admin]题目描述You are given N points (xi,yi) located on a two-dimensional plane. Consider a subset S of the N points th...原创 2018-08-07 10:17:43 · 225 阅读 · 0 评论 -
2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛A: Fruit Ninja(随机数)
链接:https://www.nowcoder.com/acm/contest/163/A来源:牛客网 题目描述Fruit Ninja is a juicy action game enjoyed by millions of players around the world, with squishy,splat and satisfying fruit carnage! Beco...原创 2018-08-05 20:44:19 · 246 阅读 · 0 评论 -
UPC6575: 11(组合数)
益,莫过一日曝十日寒。6575: 11时间限制: 1 Sec 内存限制: 128 MB提交: 135 解决: 44[提交] [状态] [讨论版] [命题人:admin]题目描述You are given an integer sequence of length n+1, a1,a2,…,an+1, which consists of the n integers 1,…,...原创 2018-08-05 10:16:38 · 189 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第六场)J题(有时候你只是不敢尝试)
链接:https://www.nowcoder.com/acm/contest/144/J来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述skywalkert, the new legend of Beihang University ACM-ICPC Team,...原创 2018-08-04 20:43:47 · 188 阅读 · 0 评论 -
UPC6616: Small Multiple(最短路 or 双端队列)
6616: Small Multiple时间限制: 1 Sec 内存限制: 512 MB提交: 407 解决: 60[提交] [状态] [讨论版] [命题人:admin]题目描述Find the smallest possible sum of the digits in the decimal notation of a positive multiple of K.Con...原创 2018-08-04 09:04:11 · 332 阅读 · 0 评论 -
UPC6615: Snuke Festival
6615: Snuke Festival时间限制: 1 Sec 内存限制: 128 MB提交: 908 解决: 203[提交] [状态] [讨论版] [命题人:admin]题目描述The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to...原创 2018-08-03 19:42:09 · 213 阅读 · 0 评论 -
UPC6617: Finite Encyclopedia of Integer Sequences
6617: Finite Encyclopedia of Integer Sequences时间限制: 1 Sec 内存限制: 128 MB提交: 239 解决: 42[提交] [状态] [讨论版] [命题人:admin]题目描述In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences o...原创 2018-08-03 19:23:01 · 209 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第五场)A-gpa(01分数规划+nth_element容器应用)
链接:https://www.nowcoder.com/acm/contest/143/A来源:牛客网 题目描述Kanade selected n courses in the university. The academic credit of the i-th course is s[i] and the score of the i-th course is c[i].At ...原创 2018-08-03 10:43:11 · 274 阅读 · 0 评论 -
UPC-6887&[JXOI2018]游戏(好题)
6887: 游戏时间限制: 1 Sec 内存限制: 512 MB提交: 217 解决: 61[提交] [状态] [讨论版] [命题人:admin]题目描述九条可怜是一个热爱游戏的女孩子,她经常在网上和一些网友们玩一款叫做《僵尸危机》游戏。在这款游戏中,玩家们会需要在成为僵尸之前与黑恶势力斗智斗勇,逃离被病毒感染的小岛。但是黑恶势力不会让玩家轻易得逞,他会把一些玩家抓走改造成僵...原创 2018-08-02 10:33:29 · 393 阅读 · 0 评论 -
HDU多校联合第四场问题 问题 L: Problem L. Visual Cube(构图)
问题 L: Problem L. Visual Cube时间限制: 1 Sec 内存限制: 512 MB提交: 42 解决: 31[提交] [状态] [讨论版] [命题人:admin]题目描述Little Q likes solving math problems very much. Unluckily, however, he does not have good spat...原创 2018-08-01 12:31:31 · 262 阅读 · 0 评论 -
UPC6605: 所罗门王的宝藏
6605: 所罗门王的宝藏时间限制: 1 Sec 内存限制: 128 MB提交: 175 解决: 63[提交] [状态] [讨论版] [命题人:admin]题目描述据古代传说记载,所罗门王既是智慧的代表,又是财富的象征。他建立了强大而富有的国家,聚集了大批的黄金象牙和钻石,并把这些价值连城的珍宝藏在一个神秘的地方,这就是世人瞩目的“所罗门王的宝藏”。多少个世纪以来,人们一直在寻...原创 2018-08-01 10:42:14 · 362 阅读 · 0 评论 -
UPC6902 Trie树(状压DP)
6902: Trie树时间限制: 1 Sec 内存限制: 128 MB提交: 176 解决: 37[提交] [状态] [讨论版] [命题人:admin]题目描述字母(Trie)树是一个表示一个字符串集合中所有字符串的前缀的数据结构,其有如下特征:1.树的每一条边表示字母表中的一个字母2.树根表示一个空的前缀3.树上所有其他的节点都表示一个非空前缀,每一个节点表示的前缀为树...原创 2018-07-31 10:55:12 · 292 阅读 · 0 评论 -
UPC6604: Sandglass(思维)
6604: Sandglass时间限制: 1 Sec 内存限制: 128 MB提交: 312 解决: 66[提交] [状态] [讨论版] [命题人:admin]题目描述We have a sandglass consisting of two bulbs, bulb A and bulb B. These bulbs contain some amount of sand. W...原创 2018-07-30 10:08:06 · 198 阅读 · 0 评论 -
牛客多校训练营Maximum Mode
链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 题目描述The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly ...原创 2018-07-29 10:04:54 · 227 阅读 · 0 评论 -
牛客多校训练营Another Distinct Values
传送门:牛客多校训练营G题题意:n表示一个矩阵为n*n矩阵,向矩阵中添加1,0,-1是的矩阵的每行每列之和各不相同。人家咋这么牛呢,自己推了半天才找到规律没啥可说的直接看代码。 #include<bits/stdc++.h>using namespace std;int a[220][220];void init(){ memset(a,1...原创 2018-07-28 16:05:33 · 204 阅读 · 0 评论 -
UPC5727小奇遐想【树状数组+容斥】
5727: 小奇遐想时间限制: 1 Sec 内存限制: 128 MB提交: 285 解决: 58[提交] [状态] [讨论版] [命题人:admin]题目描述撷来一缕清风飘渺方知今日书信未到窗外三月天霁垂柳新长枝条风中鸟啼犹带欢笑——《清风醉梦》小奇望着青天中的悠悠白云,开始了无限的遐想,在它的视野中,恰好有n朵高度不同的白云排成一排,他想从左到右选出四朵白云a,b,...原创 2018-07-28 10:55:31 · 319 阅读 · 0 评论 -
UPC5725小奇画画【贪心or瞎搞】
5725: 小奇画画时间限制: 1 Sec 内存限制: 128 MB提交: 433 解决: 74[提交] [状态] [讨论版] [命题人:admin]题目描述红莲清泪两行欲吐半点却无如初是你杳然若绯雾还在水榭畔画楼处是谁衣白衫如初谁红裳如故——《忆红莲》小奇想画几朵红莲,可惜它刚开始学画画,只能从画圆开始。小奇画了n个圆,它们的圆心都在x轴上,且两两不相交(可以相切)。...原创 2018-07-28 00:20:15 · 333 阅读 · 2 评论 -
UPC--6360: 词韵【字典树树上DP】
6360: 词韵时间限制: 2 Sec 内存限制: 128 MB提交: 157 解决: 25[提交] [状态] [讨论版] [命题人:admin]题目描述Adrian 很喜欢诗歌中的韵。他认为,两个单词押韵当且仅当它们的最长公共 后缀的长度至少是其中较长单词的长度减一。也就是说,单词 A 与单词 B 押韵 当且仅当 LCS(A, B) ≥ max(|A|, |B|) – 1。(...原创 2018-07-27 19:29:57 · 240 阅读 · 0 评论 -
UPC-6349: Talent Show【二分+DP】
6349: Talent Show时间限制: 1 Sec 内存限制: 128 MB提交: 163 解决: 59[提交] [状态] [讨论版] [命题人:admin]题目描述Farmer John is bringing his N cows, conveniently numbered 1…N, to the county fair, to compete in the ann...原创 2018-07-25 16:22:33 · 207 阅读 · 0 评论 -
UPC--6348 Milking Order 【二分+拓扑排序+优先队列】
6348: Milking Order时间限制: 3 Sec 内存限制: 128 MB提交: 167 解决: 61[提交] [状态] [讨论版] [命题人:admin]题目描述Farmer John's N cows (1≤N≤105), numbered 1…N as always, happen to have too much time on their hooves. ...原创 2018-07-25 14:41:32 · 191 阅读 · 0 评论 -
HDU 6299 Balanced Sequence 贪心
问题 B: 1002. Balanced Sequence时间限制: 1 Sec 内存限制: 128 MB提交: 16 解决: 8[提交][状态][讨论版][命题人:admin]题目描述/upload/file/20180723/20180723180123_70502.pdf输入输出样例输入21)()(()(2))(样例输出42题意...原创 2018-07-25 11:54:06 · 153 阅读 · 0 评论 -
UPC6358: 庭师的利刃
6358: 庭师的利刃时间限制: 1 Sec 内存限制: 128 MB提交: 651 解决: 117[提交] [状态] [讨论版] [命题人:admin]题目描述作为白玉楼的庭师,妖梦虽然不会n刀流,但是却领悟了生命二刀流。然而我也是个剑的收藏者,家里屯着n把剑,每一把剑都有一个灵魂值a[i],由于一些剑之间可能有共鸣,所以我需要两把契合度最高的剑。据妖梦所说,两把编号为i,j...原创 2018-07-25 08:40:42 · 174 阅读 · 0 评论 -
hdu多校联合 1004. Distinct Values
问题 D: 1004. Distinct Values时间限制: 3 Sec 内存限制: 128 MB提交: 31 解决: 21[提交][状态][讨论版][命题人:admin]题目描述/upload/file/20180723/20180723180716_87193.pdf输入输出样例输入32 11 24 21 23 45 21 32 4...原创 2018-07-24 10:24:47 · 149 阅读 · 0 评论 -
CodeForces - 975C- Valhalla Siege (前缀和)
C. Valhalla Siegetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvar the Boneless is a great leader. He is trying to capture Kattegat from Lagert...原创 2018-05-12 10:40:37 · 295 阅读 · 0 评论 -
山东省第六届ACM大学生程序设计竞赛-Square Number(素数分解+完全平方数)
Square Number 1000 ms 65536 KiBAccepted/Submissions: 9/50 (18.00%)Submit Status Statistics OriginDescriptionIn mathematics, a square number is an integer that is th原创 2018-05-04 09:14:20 · 307 阅读 · 0 评论 -
UPC 5249 Best Rational Approximation(法里数列+二分)
5249: Best Rational Approximation时间限制: 3 Sec 内存限制: 128 MB提交: 287 解决: 20[提交][状态][讨论版][命题人:admin]题目描述Many microcontrollers have no floating point unit but do have a (reasonably) fast integer divide un...原创 2018-05-01 21:09:37 · 279 阅读 · 0 评论 -
2018ACM浙江省赛 ZOJ 4029 Now Loading!!!(数学+二分)
Now Loading!!!Time Limit: 1 Second Memory Limit: 131072 KBDreamGrid has integers . DreamGrid also has queries, and each time he would like to know the value offor a given number , where , .Inpu...原创 2018-04-30 21:58:46 · 807 阅读 · 0 评论 -
Boxes(思维+二分)
问题 K: Boxes时间限制: 2 Sec 内存限制: 256 MB提交: 333 解决: 80[提交][状态][讨论版][命题人:admin]题目描述There are N boxes arranged in a circle. The i-th box contains Ai stones.Determine whether it is possible to remove all th...原创 2018-04-23 19:49:14 · 278 阅读 · 0 评论