自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

苦鬼·。

我们的裂痕,终将变成故事的花纹

  • 博客(880)
  • 资源 (4)
  • 收藏
  • 关注

原创 三元组实现矩阵压缩及运算

做了一个矩阵压缩的东西,然后简单记录一下。

2022-12-28 16:09:57 300 1

原创 LeetCode 475. 供暖器

冬季已经来临。 你的任务是设计一个有固定加热半径的供暖器向所有房屋供暖。在加热器的加热半径范围内的每个房屋都可以获得供暖。现在,给出位于一条水平线上的房屋 houses 和供暖器 heaters 的位置,请你找出并返回可以覆盖所有房屋的最小加热半径。说明:所有供暖器都遵循你的半径标准,加热的半径也一样。示例 1:输入: houses = [1,2,3], heaters = [2]输出: 1解释: 仅在位置2上有一个供暖器。如果我们将加热半径设为1,那么所有房屋就都能得到供暖。示例 2:输

2022-01-24 16:32:13 321 3

原创 0-1背包问题的回溯法实现

0-1背包问题的回溯法实现,不知道为啥要做一个回溯法实现。2^n状态的搜索树,枚举#include<iostream>#include<cstdio>#include<cstring>#include<iomanip>#include<algorithm>#define Maxn 10000using namespace std;int mn[Maxn],mnn[Maxn],perw[Maxn],maxw;template&

2021-12-29 10:56:04 541

原创 LeetCode 155. 最小栈

好久没刷题了,最近刷题见到这个一个题,题目本身很简单,做一个辅助栈,时间效率跑过100%的用户,但是在讨论区看到 一次面试的时候,面试官要求不开辅助栈的做法,感觉这个值得思考。做法是在栈内记录一个最小值,同时栈内存储于最小值的差值。但任然离不开栈的先进后出性质。设计一个支持 push ,pop ,top 操作,并能在常数时间内检索到最小元素的栈。push(x) —— 将元素 x 推入栈中。pop() —— 删除栈顶的元素。top() —— 获取栈顶元素。getMin() —— 检索栈中的最小元素。

2021-12-02 10:38:58 129

原创 编译原理 实验(词法分析)

词法分析基于文法词法分析C/C++的代码直接上代码原理很简单,就是检测C/C++的保留字,无符号常数,字母数字的组合判定为标识符直接上Java代码:import java.io.*;import java.util.ArrayList;import java.util.List;// 输入文件不应包含空行, 空行会导致程序结束,后面的程序无法分析public class Analyse { public static void main(String[] args) throw

2021-11-06 23:13:00 359

原创 7-1 银行业务队列简单模拟 (25 分)

7-1 银行业务队列简单模拟 (25 分)设某银行有A、B两个业务窗口,且处理业务的速度不一样,其中A窗口处理速度是B窗口的2倍 —— 即当A窗口每处理完2个顾客时,B窗口处理完1个顾客。给定到达银行的顾客序列,请按业务完成的顺序输出顾客序列。假定不考虑顾客先后到达的时间间隔,并且当不同窗口同时处理完2个顾客时,A窗口顾客优先输出。输入格式:输入为一行正整数,其中第1个数字N(≤1000)为顾客总数,后面跟着N位顾客的编号。编号为奇数的顾客需要到A窗口办理业务,为偶数的顾客则去B窗口。数字间以空格分隔

2021-10-27 10:42:56 238

原创 LeetCode 5. 最长回文子串

好久没写博客了,今天重拾。。。。最长回文子串给你一个字符串 s,找到 s 中最长的回文子串。示例 1:输入:s = “babad”输出:“bab”解释:“aba” 同样是符合题意的答案。示例 2:输入:s = “cbbd”输出:“bb”示例 3:输入:s = “a”输出:“a”示例 4:输入:s = “ac”输出:“a”提示:1 <= s.length <= 1000s 仅由数字和英文字母(大写和/或小写)组成/* * @lc app=leetcode

2021-10-12 22:17:28 114

原创 6-7 在一个数组中实现两个堆栈 (20 分)

本题要求在一个数组中实现两个堆栈。函数接口定义:Stack CreateStack( int MaxSize );bool Push( Stack S, ElementType X, int Tag );ElementType Pop( Stack S, int Tag );其中Tag是堆栈编号,取1或2;MaxSize堆栈数组的规模;Stack结构定义如下:typedef int Position;struct SNode { ElementType *Data; Posi

2021-08-29 00:58:59 2139

原创 Codeforces 780 A~D

文章目录A Andryusha and SocksB The Meeting Place Cannot Be ChangedC Andryusha and Colored BalloonsD Innokenty and a Football LeagueA Andryusha and SocksB The Meeting Place Cannot Be ChangedC Andryusha and Colored BalloonsD Innokenty and a Football League

2021-04-06 19:42:52 206

原创 CodeForces 866B Ordering Pizza

B. Ordering Pizzatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt’s another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (

2021-03-24 16:58:04 211

原创 Codeforces Round #491 (Div. 2)

@[TOC](Codeforces Round #491 (Div. 2))A. If at first you don’t succeed…题目大意:给出A、B、C、N。表示去BugDonalds的有A个人,去BeaverKing的有B个人,两者都去的有C人,一共有N人,问,有多少人没两者都没去。 答案非法 输出-1。提示:以下是本篇文章正文内容,下面案例可供参考B. Getting an A题目大意: 至少重做几门作业能让平均分是5分,平均分的计算四舍五入。C. Candie

2021-03-17 16:34:19 133

原创 CodeForces #869 Div2

CodeForces #869 Div2A. The Artful ExpedientB. The Eternal ImmortalityD. The Overdosing UbiquityA. The Artful Expedienttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRock... Paper!After Karen h

2021-03-16 20:24:44 763

原创 UVA - 818 Cutting Chains 深度好文 仔细研读

What a find! Anna Locke has just bought several links of chain some of which may be connected. Theyare made from zorkium, a material that was frequently used to manufacture jewelry in the last century,but is not used for that purpose anymore. It has its

2021-03-10 16:20:19 2176

原创 UVA - 806 Spatial Structures

Computer graphics, image processing, and GIS (geographic information systems) all make use of a datastructure called a quadtree. Quadtrees represent regional or block data efficiently and support efficientalgorithms for operations like the union and inte

2021-03-02 20:22:20 148

原创 UVa 753 A Plug for UNIX EK算法即可

You are in charge of setting up the press room for the inaugural meeting of the United Nations InterneteXecutive (UNIX), which has an international mandate to make the free flow of information and ideason the Internet as cumbersome and bureaucratic as po

2021-02-22 10:25:44 155

原创 UVA 12661 Funny Car Racing

There is a funny car racing in a city with n junctions and m directed roads.The funny part is: each road is open and closed periodically. Each road is associate with twointegers (a, b), that means the road will be open for a seconds, then closed for b se

2021-02-17 12:55:46 124

原创 UVA 658 It‘s not a Bug, it‘s a Feature!

It is a curious fact that consumers buying a new software product generally do not expect the softwareto be bug-free. Can you imagine buying a car whose steering wheel only turns to the right? Or aCD-player that plays only CDs with country music on them?

2021-02-17 12:16:58 160

原创 UVa1151 Buy or Build

World Wide Networks (WWN) is a leading company that operates large telecommunication networks.WWN would like to setup a new network in Borduria, a nice country that recently managed to get ridof its military dictator Kurvi-Tasch and which is now seeking

2021-02-14 19:09:52 124

原创 UVA - 12219 Common Subexpression Elimination

Let the set Σ consist of all words composed of 1-4 lower case letters, such as the words “a”, “b”, “f”,“aa”, “fun” and “kvqf”. Consider expressions according to the grammar with the two rulesE → fE → f(E, E)for every symbol f ∈ Σ. Any expression can ea

2021-02-14 14:00:53 189

原创 Codeforces Round #694 div2

Codeforces Round #694 div2这次的div2 还算是简单。。。文章目录Codeforces Round #694 div2A. Strange PartitionB. Strange ListC. Strange Birthday PartyD. Strange DefinitionA. Strange Partition不多说 直接代码:#include<iostream>#include<cstdio>#include<cstring&g

2021-02-08 09:56:43 113

原创 Codeforces Round #697 (Div. 3) Finshed

A. Odd Divisortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n. Check if n has an odd divisor, greater than one (does there exist such a number x (x>1) that n is divisi

2021-02-03 13:06:10 160

原创 Codeforces Round #696 (Div. 2)

A. Puzzle From the Futuretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the 2022 year, Mike found two binary integers a and b of length n (both of them are written only by digits 0 and 1) that c

2021-01-24 15:01:11 102

原创 UVA - 122 Trees on the level

Trees on the levelTrees are fundamental in many branches of computer science (Pun definitely intended). Current stateof-the art parallel computers such as Thinking Machines’ CM-5 are based on fat trees. Quad- andoctal-trees are fundamental to many algori

2021-01-19 20:42:01 115

原创 UVA - 210 Concurrency Simulator

UVA - 210 Concurrency SimulatorPrograms executed concurrently on a uniprocessor system appear to be executed at the same time, butin reality the single CPU alternates between the programs, executing some number of instructions fromeach program before sw

2021-01-19 20:03:08 87

原创 UVA - 815 Flooded!

FloodedTo enable homebuyers to estimate the cost of flood insurance, a real-estate firm provides clients withthe elevation of each 10-meter by 10-meter square of land in regions where homes may be purchased.Water from rain, melting snow, and burst water

2021-01-14 15:16:44 103

原创 Codeforces Round #695 (Div. 2)

一月八号的比赛,今天我才来补比赛A. Wizard of Orztime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n digital panels placed in a straight line. Each panel can show any digit from 0 to 9. Initially, all panel

2021-01-13 21:25:51 119

原创 UVA - 12108 Extraordinarily Tired Students

When a student is too tired, he can’t help sleeping in class, even if his favorite teacher is right here infront of him. Imagine you have a class of extraordinarily tired students, how long do you have to wait,before all the students are listening to you

2021-01-12 17:12:44 101

原创 UVA - 220 Othello

Othello is a game played by two people on an 8 x 8 board, using disks that are white on one side andblack on the other. One player places disks with the white side up and the other player places diskswith the black side up. The players alternate placing

2021-01-11 22:10:25 162

原创 UVA - 1587 Box

Ivan works at a factory that produces heavy machinery. He has a simple job — he knocks up woodenboxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangularparallelepiped. Ivan uses six rectangular wooden pallets to

2021-01-11 13:50:01 105

原创 UVA - 227 Puzzle

A children’s puzzle that was popular 30 years ago consisted of a 5×5 frame which contained 24 smallsquares of equal size. A unique letter of the alphabet was printed on each small square. Since therewere only 24 squares within the frame, the frame also c

2021-01-11 13:32:34 98

原创 UVA - 340 Master-Mind Hint

MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker,tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the playersagree upon the length N that a code must have a

2021-01-10 17:14:25 83

原创 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 229

原创 PTA L3-025 那就别担心了 (30分)

L3-025 那就别担心了 (30分)下图转自“英式没品笑话百科”的新浪微博 —— 所以无论有没有遇到难题,其实都不用担心。博主将这种逻辑推演称为“逻辑自洽”,即从某个命题出发的所有推理路径都会将结论引导到同一个最终命题(开玩笑的,千万别以为这是真正的逻辑自洽的定义……)。现给定一个更为复杂的逻辑推理图,本题就请你检查从一个给定命题到另一个命题的推理是否是“逻辑自洽”的,以及存在多少种不同的推理路径。例如上图,从“你遇到难题了吗?”到“那就别担心了”就是一种“逻辑自洽”的推理,一共有 3 条不同的推理

2020-12-09 17:29:12 704

原创 PTA L2-032 彩虹瓶 (25分)

L2-032 彩虹瓶 (25分)彩虹瓶的制作过程(并不)是这样的:先把一大批空瓶铺放在装填场地上,然后按照一定的顺序将每种颜色的小球均匀撒到这批瓶子里。假设彩虹瓶里要按顺序装 N 种颜色的小球(不妨将顺序就编号为 1 到 N)。现在工厂里有每种颜色的小球各一箱,工人需要一箱一箱地将小球从工厂里搬到装填场地。如果搬来的这箱小球正好是可以装填的颜色,就直接拆箱装填;如果不是,就把箱子先码放在一个临时货架上,码放的方法就是一箱一箱堆上去。当一种颜色装填完以后,先看看货架顶端的一箱是不是下一个要装填的颜色,如果

2020-11-25 11:23:33 197

原创 PTA L2-005 集合相似度 (25分)

L2-005 集合相似度 (25分)给定两个整数集合,它们的相似度定义为:N​c​​ /N​t​​ ×100%。其中N​c​​ 是两个集合都有的不相等整数的个数,N​t​​ 是两个集合一共有的不相等整数的个数。你的任务就是计算任意一对给定集合的相似度。输入格式:输入第一行给出一个正整数N(≤50),是集合的个数。随后N行,每行对应一个集合。每个集合首先给出一个正整数M(≤10​4​​ ),是集合中元素的个数;然后跟M个[0,10​9​​ ]区间内的整数。之后一行给出一个正整数

2020-11-24 21:37:27 137

原创 PTA L2-004 这是二叉搜索树吗? (25分)

L2-004 这是二叉搜索树吗? (25分)一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点,其左子树中所有结点的键值小于该结点的键值;其右子树中所有结点的键值大于等于该结点的键值;其左右子树都是二叉搜索树。所谓二叉搜索树的“镜像”,即将所有结点的左右子树对换位置后所得到的树。给定一个整数键值序列,现请你编写程序,判断这是否是对一棵二叉搜索树或其镜像进行前序遍历的结果。输入格式:输入的第一行给出正整数 N(≤1000)。随后一行给出 N 个整数键值,其间以空格分隔。输出格式

2020-11-24 20:31:38 384

原创 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 135

原创 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 161

原创 PTA L2-002 链表去重 (25分)

L2-002 链表去重 (25分)给定一个带整数键值的链表 L,你需要把其中绝对值重复的键值结点删掉。即对每个键值 K,只有第一个绝对值等于 K 的结点被保留。同时,所有被删除的结点须被保存在另一个链表上。例如给定 L 为 21→-15→-15→-7→15,你需要输出去重后的链表 21→-15→-7,还有被删除的链表 -15→15。输入格式:输入在第一行给出 L 的第一个结点的地址和一个正整数 N(≤10​5​​ ,为结点总数)。一个结点的地址是非负的 5 位整数,空地址 NULL 用 −1 来表

2020-11-21 22:41:34 377

原创 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 405

DVD在线租赁.docx

DVD在线租赁.docx

2020-12-19

CLion2019汉化脚本.rar

CLion好用是好用,但是对于我整个英语白痴,汉化就显得尤为重要了,在此提供汉化的解决方案,还不够五十个字么,这下应该够了吧

2020-02-04

树的DFS序及其应用

适用于正在搞OI的选手学习和提高,一种很不错的思想,近年来NOIP考察树上的东西渐多,值得好好学习

2017-10-20

组合数学(计算机)

美国威斯康星大学出版的《组合数学》,近年来成为计算机专业的必修课,值得深入学习。

2017-10-20

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除