![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
七情六欲·
唔西迪西 糊不拉几
展开
-
Educational Codeforces Round 100 (Rated for Div. 2)
好久没有打比赛了,,,,,ggggggggA. Dungeontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you me原创 2020-12-22 11:09:24 · 241 阅读 · 0 评论 -
PTA L3-025 那就别担心了 (30分)
L3-025 那就别担心了 (30分)下图转自“英式没品笑话百科”的新浪微博 —— 所以无论有没有遇到难题,其实都不用担心。博主将这种逻辑推演称为“逻辑自洽”,即从某个命题出发的所有推理路径都会将结论引导到同一个最终命题(开玩笑的,千万别以为这是真正的逻辑自洽的定义……)。现给定一个更为复杂的逻辑推理图,本题就请你检查从一个给定命题到另一个命题的推理是否是“逻辑自洽”的,以及存在多少种不同的推理路径。例如上图,从“你遇到难题了吗?”到“那就别担心了”就是一种“逻辑自洽”的推理,一共有 3 条不同的推理原创 2020-12-09 17:29:12 · 734 阅读 · 0 评论 -
PTA L2-032 彩虹瓶 (25分)
L2-032 彩虹瓶 (25分)彩虹瓶的制作过程(并不)是这样的:先把一大批空瓶铺放在装填场地上,然后按照一定的顺序将每种颜色的小球均匀撒到这批瓶子里。假设彩虹瓶里要按顺序装 N 种颜色的小球(不妨将顺序就编号为 1 到 N)。现在工厂里有每种颜色的小球各一箱,工人需要一箱一箱地将小球从工厂里搬到装填场地。如果搬来的这箱小球正好是可以装填的颜色,就直接拆箱装填;如果不是,就把箱子先码放在一个临时货架上,码放的方法就是一箱一箱堆上去。当一种颜色装填完以后,先看看货架顶端的一箱是不是下一个要装填的颜色,如果原创 2020-11-25 11:23:33 · 199 阅读 · 0 评论 -
PTA L2-005 集合相似度 (25分)
L2-005 集合相似度 (25分)给定两个整数集合,它们的相似度定义为:Nc /Nt ×100%。其中Nc 是两个集合都有的不相等整数的个数,Nt 是两个集合一共有的不相等整数的个数。你的任务就是计算任意一对给定集合的相似度。输入格式:输入第一行给出一个正整数N(≤50),是集合的个数。随后N行,每行对应一个集合。每个集合首先给出一个正整数M(≤104 ),是集合中元素的个数;然后跟M个[0,109 ]区间内的整数。之后一行给出一个正整数原创 2020-11-24 21:37:27 · 157 阅读 · 0 评论 -
PTA L2-004 这是二叉搜索树吗? (25分)
L2-004 这是二叉搜索树吗? (25分)一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点,其左子树中所有结点的键值小于该结点的键值;其右子树中所有结点的键值大于等于该结点的键值;其左右子树都是二叉搜索树。所谓二叉搜索树的“镜像”,即将所有结点的左右子树对换位置后所得到的树。给定一个整数键值序列,现请你编写程序,判断这是否是对一棵二叉搜索树或其镜像进行前序遍历的结果。输入格式:输入的第一行给出正整数 N(≤1000)。随后一行给出 N 个整数键值,其间以空格分隔。输出格式原创 2020-11-24 20:31:38 · 387 阅读 · 0 评论 -
PTA L2-003 月饼 (25分)
L2-003 月饼 (25分)月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有 3 种月饼,其库存量分别为 18、15、10 万吨,总售价分别为 75、72、45 亿元。如果市场的最大需求量只有 20 万吨,那么我们最大收益策略应该是卖出全部 15 万吨第 2 种月饼、以及 5 万吨第 3 种月饼,获得 72 + 45/2原创 2020-11-24 17:23:59 · 138 阅读 · 0 评论 -
Gym-101142C. CodeCoder vs TopForcesProblem
Problem C. CodeCoder vs TopForcesInput file: codecoder.inOutput file: codecoder.outTime limit: 2 secondsMemory limit: 256 megabytesCompetitive programming is very popular in Byteland. In fact, every Bytelandian citizen is registeredat two programming原创 2020-11-23 15:07:55 · 179 阅读 · 0 评论 -
PTA L2-002 链表去重 (25分)
L2-002 链表去重 (25分)给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后的链表 21→-15→-7,还有被删除的链表 -15→15。输入格式:输入在第一行给出 L 的第一个结点的地址和一个正整数 N(≤105 ,为结点总数)。一个结点的地址是非负的 5 位整数,空地址 NULL 用 −1 来表原创 2020-11-21 22:41:34 · 389 阅读 · 0 评论 -
PTA L2-001 紧急救援 (25分)
L2-001 紧急救援 (25分)作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领你的救援队尽快赶往事发地,同时,一路上召集尽可能多的救援队。输入格式:输入第一行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0 ~ (N−1);M是快速道路的条数;S是出发地的城市编号;D是目的地原创 2020-11-21 15:34:15 · 409 阅读 · 0 评论 -
PTA 天梯赛集 L3-011 直捣黄龙 (30分)
PTA 直捣黄龙L3-011 直捣黄龙 (30分)本题是一部战争大片 —— 你需要从己方大本营出发,一路攻城略地杀到敌方大本营。首先时间就是生命,所以你必须选择合适的路径,以最快的速度占领敌方大本营。当这样的路径不唯一时,要求选择可以沿途解放最多城镇的路径。若这样的路径也不唯一,则选择可以有效杀伤最多敌军的路径。输入格式:输入第一行给出 2 个正整数 N(2 ≤ N ≤ 200,城镇总数)和 K(城镇间道路条数),以及己方大本营和敌方大本营的代号。随后 N-1 行,每行给出除了己方大本营外的一个城原创 2020-11-17 20:27:12 · 1948 阅读 · 3 评论 -
ICPC Yokohama 2019 训练赛
A-FastForwardingMr. Anderson frequently rents video tapes of his favorite classic films. Watching the films so many times, he has learned the precise start times of his favorite scenes in all such films. He now wants to find how to wind the tape to watch原创 2020-08-23 13:42:30 · 469 阅读 · 0 评论 -
POJ 1442 Black Box Treap 查询第K大
Black BoxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 17311 Accepted: 7041DescriptionOur Black Box represents a primitive database. It can save an integer array and has a special i variable. At the initial moment Black Box is empty and i原创 2020-08-20 16:55:07 · 156 阅读 · 0 评论 -
ACM 训练赛 ICPC Yokohama 2018(部分题目来自 GYM)
B关于下面这分代码我又很多要说的,本来用的是map来检查temp是否存在,然后这样可能会出现很多的序列中没有的值,但是ma[temp]的时候尽管没有这个值,map会再建立一个temp的节点,直接导致内存炸掉,本来写的5000*5000 两千五百万的int数组并不是内存炸掉的原因。改成set的count函数 然后直接A掉,后来比赛结束的时候队友也是才知道,告诉我map原来也有count函数,改成map的count函数这个题也是可以直接A掉。 直到这里我才知道map也有count函数。晚上刷牙的时候原创 2020-08-16 14:02:15 · 266 阅读 · 0 评论 -
German Collegiate Programming Contest 2017
B. BuildingsAs a traveling salesman in a globalized world, Alan has always moved a lot. He almost neverlived in the same town for more than a few years until his heart yearned for a different place.However, this newest town is his favorite yet - it is jus原创 2020-08-15 10:19:58 · 155 阅读 · 0 评论 -
ICPC Pacific Northwest Regional Contest 2017 (计蒜客马拉松赛)
A. Odd PalindromeWe say that a string is oddodd if and only if all palindromic substrings of the string have odd length.Given a string ss, determine if it is oddodd or not.A substring of a string ss is a nonempty sequence of consecutive characters from原创 2020-08-08 10:05:19 · 367 阅读 · 0 评论 -
HDU 5884 Sort(K叉哈夫曼树例题)
SortTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6398 Accepted Submission(s): 1588Problem DescriptionRecently, Bob has just learnt a naive sorting algorithm: merge sort. Now, Bob receives a原创 2020-08-07 11:38:24 · 227 阅读 · 0 评论 -
German Collegiate Programming Contest 2019 算了我吐了,全是英文题解 以后补
Problem H: Jazz Enthusiast时间限制: 1 Sec 内存限制: 128 MB提交: 475 解决: 175[提交] [命题人:外部导入]题目描述Kai is listening to his favourite jazz playlist. He likes to turn on crossfading between songs, so during the last seconds of a song, it will slowly fade out while t原创 2020-08-02 10:39:58 · 211 阅读 · 0 评论 -
ICPC Arab Collegiate Programming Contest 2014
给N个密码,密码 A 和密码 B 如果长度相同,而且对于每个位置 i ,都有 | A[i] - B[i] |相同,那么则称密码 A 和密码 B 是等价的。输入密码时会跳过和之前输入过密码相等价的密码。求最多要按顺序输入多少个密码。解题思路:模拟即可(确信)。其实上只需高效判断当前密码是否有相等价的被输入了即可。换个角度考虑,输入了一个新密码的之后,我们会跳过所有与它等价的密码。所以,我们不妨同时也“输入”所有与它等价的密码,然后在之后即容易判断当前密码是否有与它等价的密码被输入过了。如何枚举所有与原创 2020-07-29 20:57:12 · 291 阅读 · 0 评论 -
UCF Local Programming Contest 2019(Practice) Sub Matrix Sum
Sub Matrix SumYou have written many programs to search mazes so matrix search shouldn’t be any different, or will it?The Problem:An integer matrix with R rows and C columns has 图片1.png sub matrices. We want to select a sub matrix with sum (the sum of al原创 2020-07-28 23:32:40 · 160 阅读 · 0 评论 -
POJ 3061 Subsequence
其实做这个题是为了解决一道最近比赛做到的题,但是吧来写博客的时候我突然想到,自己以前可能做过这个题,查了一下POJ的提交记录,我果然在三年前交过这个题 滑动窗口板子题SubsequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 32899 Accepted: 13687DescriptionA sequence of N positive integers (10 < N < 100 000), e原创 2020-07-28 18:29:57 · 131 阅读 · 0 评论 -
UCF Local Programming Contest 2013
知道今天的出现了好多原题,我才意识到前两天的两场比赛都没有整理…A. Circles Inside a SquareYou have 8 circles of equal size and you want to pack them inside a square. You want to minimize the size of the square. The following figure illustrates the minimum way of packing 8 circles insid原创 2020-07-28 13:31:13 · 349 阅读 · 0 评论 -
百度之星2020 初赛第三场
DiscountAccepts: 1432 Submissions: 2728Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem Description学皇来到了一个餐馆吃饭。他觉得这家餐馆很好吃,于是就想办个会员。一共有 nn 种会员充值卡套餐,假设学皇这餐饭的消费为 aa 元,选择第 ii 种套餐,需要充值 b[i] * ab[i]∗a 的钱,这次吃饭可以打 c[i]原创 2020-07-27 10:14:33 · 407 阅读 · 5 评论 -
百度之星2020 初赛第二场
昨天是百度之星算法竞赛初赛的第二场,越做越崩溃,,,今天早上早早起来补题先上官方题解其中应该是一二四题可做,第五题我以为是贪心或者决策优化,没想到题解给出的是网络流真好啊 ,,,大早上起来,HDU的评测机专为我开放PokerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 306 Accepted Submission(s)原创 2020-07-26 08:25:52 · 1295 阅读 · 0 评论 -
UCF Local Programming Contest 2019(Practice)
今天是 信息工程大学 主持比赛,有几个非常好的题,但是剩下的就是水题 哈哈????????????????先发一个让我吐了的题Spell CheckerThis question is about automatic spelling correction. Studies have shown that the majority of typing errors are caused by (let’s assume the dictionary contains the word “these”原创 2020-07-25 12:51:45 · 420 阅读 · 0 评论 -
POJ 3067 Japan
JapanTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 37164 Accepted: 9949DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M原创 2020-07-23 22:49:07 · 168 阅读 · 0 评论 -
POJ 3321 Apple Tree
Apple TreeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 44169 Accepted: 13006DescriptionThere is an apple tree outside of kaka’s house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefu原创 2020-07-23 18:00:58 · 101 阅读 · 0 评论 -
POJ 3461 Oulipo
OulipoTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 62133 Accepted: 23967DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter ‘e’. He was a member of the Oulipo group. A quote from t原创 2020-07-23 16:59:50 · 143 阅读 · 0 评论 -
HDU 3613 Best Reward
Best RewardTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 6830 Accepted Submission(s): 2807Problem DescriptionAfter an uphill battle, General Li won a great victory. Now the head of state deci原创 2020-07-23 16:02:26 · 114 阅读 · 0 评论 -
ICPC Arab Collegiate Programming Contest 2013
今天有一场比赛,虽然是复现的2013年的某一场比赛,十二点到五点,今天出奇的顺利,三点半我们三人就愉快的决定提前下班了 哈哈哈哈哈。不过说实话这场比赛应该是水题很多,,,,,????????????????????????都有题号,现在这些题目都被UVa收录,可以测评A.The Alphabet Sticker UVALive - 6754When we were kids, we used to play with some stickers where these stickers contai原创 2020-07-22 22:34:32 · 270 阅读 · 0 评论 -
HDU 4080 Stammering Aliens
Stammering AliensTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3025 Accepted Submission(s): 957Problem DescriptionDr. Ellie Arroway has established contact with an extraterrestrial civilizat原创 2020-07-21 23:29:20 · 273 阅读 · 0 评论 -
POJ 1703 Find them, Catch them
Find them, Catch themTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 62691 Accepted: 19002DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Ga原创 2020-07-21 15:22:20 · 98 阅读 · 0 评论 -
POJ 1988 Cube Stacking
Farmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks Betsy to perform P (1<= P <= 100,000) operation. There are two type原创 2020-07-21 15:00:22 · 121 阅读 · 0 评论 -
A - Palindrome
Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, “Can you propose an efficient algorithm to find the length of the largest palindrome in a string?”A string is said to be a p原创 2020-07-21 13:03:50 · 281 阅读 · 0 评论 -
UVA - 11816 HST
HST评测链接 : https://vjudge.net/problem/UVA-11816On July 1st, Ontario’s Provincial Sales Tax(PST) was merged with the Federal Goods andServices Tax (GST), creating the HarmonizedSales Tax (HST). This changed the rate of taxOntarians pay on various item原创 2020-07-20 23:15:14 · 250 阅读 · 0 评论 -
Gym - 102367C Pawn‘s Revenge
Pawn’s RevengeYou are playing a special chess game against a professor and you’ve almost lost: the only piece you have left is a king. The professor just left the room to take a call, so you decided to cheat a little bit and put some extra pawns on the bo原创 2020-07-20 22:16:01 · 217 阅读 · 0 评论 -
计蒜客A1484 Tunnelling the Earth
There are different methods of transporting people from place to place: cars, bikes, boats, trains, planes, etc. For very long distances, people generally fly in a plane. But this has the disadvantage that the plane must fly around the curved surface of th原创 2020-07-20 19:12:52 · 148 阅读 · 0 评论 -
POJ 2083 Fractal
FractalTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 18196 Accepted: 7509DescriptionA fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit exactly the sa原创 2020-07-19 11:13:53 · 262 阅读 · 0 评论 -
POJ 1664 放苹果
放苹果Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 43882 Accepted: 26568Description把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。Output对输入的原创 2020-07-18 22:25:28 · 127 阅读 · 0 评论 -
Codeforces Round #650 (Div. 3)
A. Short Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice guesses the strings that Bob made for her.At first, Bob came up with the secret string a consisting of lowercase English le原创 2020-06-24 16:10:11 · 300 阅读 · 0 评论 -
Codeforces Round #645 (Div. 2)
A. Park Lightingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDue to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to原创 2020-05-27 09:36:05 · 213 阅读 · 0 评论