自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 bs4多线程解析下载p站每日图片 (Try)

*Pixiv镜像地址:**https://www.vilipix.com/

2023-06-27 14:25:25 333

原创 bs4解析并下载P站图片(随练Try)

【代码】bs4解析并下载P站图片(随练Try)

2023-06-16 11:34:10 398

原创 JavaFx 启动界面制作(类似IDEA启动界面)

一个简单的淡入显示界面,进度条加载完毕后关闭,打开程序的主界面。

2023-04-17 16:37:49 910 1

原创 雪花雪花雪花

因为雪花的形状是封闭的环形,所以从任何一个角开始顺时针或逆时针往后记录长度,得到的六元组都代表形状相同的雪花。每行包含 6 个整数,分别代表雪花的六个角的长度(这六个数即为从雪花的随机一个角顺时针或逆时针记录长度得到)。我们称两片雪花形状相同,当且仅当它们各自从某一角开始顺时针或逆时针记录长度,能得到两个相同的六元组。有 N 片雪花,每片雪花由六个角组成,每个角都有长度。求这 N 片雪花中是否存在两片形状相同的雪花。第一行输入一个整数 NN,代表雪花的数量。就是形状相同的雪花。也是形状相同的雪花。

2023-04-14 15:37:36 395

原创 POJ - 1797 Heavy Transportation (求路径上最大权值)

Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his customer has build his giant steel crane to the place where it is neede

2022-07-09 21:37:02 146

原创 操作系统期末白给复习

操作系统期末白给复习。老师菜菜,捞捞。

2022-06-21 22:49:03 1515

原创 PAT-甲级 1119 Pre- and Post-order Traversals (前序+后序 求中序遍历)

1.测试点1如果错误的话,数组大小需要开到100左右即可。一开始开66,错了。2.除测试点1外,全部报格式错误。这个需要在中序遍历输出完后输出一个换行即可。前序和后序 求中序遍历和中序种类...

2022-06-04 16:09:04 207 1

原创 PAT-甲级 1115 Counting Nodes in a Binary Search Tree(BST插入和层序遍历)

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:Insert a sequence of numbers into an initially empty binary search tree. Then you are supposed to count the total number of nodes in the lowest 2 levels o

2022-06-03 22:23:05 193

原创 AVL平衡二叉搜索树 (介绍+例题)

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property. Figures 1-4 illustrate t

2022-06-03 15:57:50 5313 1

原创 PAT-甲级 1131 Subway Map(Dfs+路径打印)

Question:In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed to help people with your computer skills! Given the starting position

2022-05-31 19:11:33 191

原创 PAT-甲级 1126 Eulerian Path(并查集判图连通 + 欧拉图与欧拉回路判断)

Question:In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the same vertex. They were first discussed by Leonhard Euler while solving th

2022-05-30 17:01:48 107

原创 PAT-甲级 1127 ZigZagging on a Tree(中序+后序造树,牛牛层序输出)

Question:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences. And it is a simple standard routine to print the numbers in level-orde

2022-05-30 17:01:04 110

原创 PAT-甲级1133 Splitting A Linked List (简单链表操作)

Question:Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the values in [0, K] appear before all those greater than K. The order of the elements inside e

2022-05-29 21:46:19 94

原创 Hurdles of 110m(类背包问题)

描述In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.Liu Xiang is one of the famous Olympic athletes in China. In 2002

2022-05-29 19:46:35 134

原创 PAT-甲级 1143 Lowest Common Ancestor( 规律BST找LCA)

QuestionThe lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a

2022-05-25 11:35:42 104

原创 PAT-甲级 1145 Hashing - Average Search Time(哈希正向平方探测法的插入与查找)

QuestionThe task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer keys from the table and output the average search time (the number of comparisons made to fin

2022-05-25 10:52:11 196

原创 Hexo博客搭建和部署github(简略文字版~)

主要内容:Hexo的搭建Hexo 部署到githubHexo主题配置Hexo网页标题乱码问题Hexo页面部署成功,打开界面缺显示404hexo 缺少git组件Hexo的搭建安装Nodejsnode -v #查看node版本npm -v #查看npm版本上述步骤查看环境变量是否配置成功(下同)npm install -g cnpm --registry=http://registry.npm.taobao.org #安装淘宝的cnpm 管理器cnpm -v #查看cnpm版本cnpm ins

2022-05-23 19:49:06 357

原创 PTA-甲级1021 Deepest Root(DFS,类似树的直径)

QuestionA graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.Input Specification

2022-05-17 22:14:47 155

原创 PAT甲级-Structure of a Binary Tree(中序+后序建树)

QuestionSuppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, a binary tree can be uniquely determined.Now given a sequence of statements about the structure of the resulting tree,

2022-05-16 23:42:22 278

原创 PTA甲级1167 Cartesian Tree (笛卡尔建树 or 规律建树)

QuestionA Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence. For example, given the sequence { 8, 15, 3, 4, 1, 5, 12, 10, 18, 6 }, the min-heap

2022-05-12 11:40:44 240

原创 疫情防控(并查集 + 思维)

问题描述疫情尚未结束,严防疫情反复。为了做好疫情防控工作,国内设置了地区风险等级,对于中高风险地区的人员采取限制移动、居家隔离等手段。为了研究疫情防控对于跨地区交通运输的影响,假设现在有 N 个机场,M 条航线,每天都会新增一个防控地区,一个防控地区会导致一个机场无法正常运作,航线也自然无法正常运行,每天会有 Qi​ 对旅客从 Xi​ 机场前往 Yi​ 机场,请计算有多少对旅客会受到影响无法完成行程。旅客只要能直达或通过若干次中转,且乘坐的所有航线的出发和到达机场都正常运作,即视作可完成行程。输入格

2022-05-11 20:53:54 174

原创 传纸条 (dp入门)

描述小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题。一次素质拓展活动中,班上同学安排做成一个m行n列的矩阵,而小渊和小轩被安排在矩阵对角线的两端,因此,他们就无法直接交谈了。幸运的是,他们可以通过传纸条来进行交流。纸条要经由许多同学传到对方手里,小渊坐在矩阵的左上角,坐标(1,1),小轩坐在矩阵的右下角,坐标(m,n)。从小渊传到小轩的纸条只可以向下或者向右传递,从小轩传给小渊的纸条只可以向上或者向左传递。在活动进行中,小渊希望给小轩传递一张纸条,同时希望小轩给他回复。班里每个同学都可以帮他

2022-05-10 20:56:36 310

原创 Tokitsukaze and Good 01-String(Dp or 贪心)

QuestionThis is the hard version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments.Tokitsukaze has a binary string s of length n, consisting only of zeros and one

2022-05-09 22:03:47 577 1

原创 龟兔赛跑 (入门 dp)

Problem Description据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。 最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深知获胜希望不大,不过迫于舆论压力,只能接受挑战。 比赛是设在一条笔直的道路上,长度为L米,规则很简单,谁先到达终点谁就算获

2022-05-08 16:16:06 92

原创 免费馅饼 (类似数塔,入门dp)

描述都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝,每秒种只有在移动不超过一米的范围内接住坠落的馅饼。现在给这条小径如图标上坐标:![[Pasted im

2022-05-08 16:15:13 50

原创 Dorms War (思维, CF788.B)

QuestionHosssam decided to sneak into Hemose's room while he is sleeping and change his laptop's password. He already knows the password, which is a string s of length n. He also knows that there are k special letters of the alphabet: c1,c2,…,ck.Hosssa

2022-05-07 22:21:11 308

原创 字串变换(双向BFS)

问题描述:已知有两个字串A,B及一组字串变换的规则(至多6个规则):A1→B1A2→B2…规则的含义为:在A中的子串A1可以变换为B1、A2可以变换为B2…。例如:A=abcdB=xyz变换规则为:abc→xu,ud→y,y→yz则此时,A可以经过一系列的变换变为B,其变换的过程为:abcd→xud→xy→xyz共进行了三次变换,使得A变换为B。输入格式输入格式如下:ABA1B1...

2022-05-06 21:40:11 340

原创 聪明的打字员(BFS + 模拟)

阿兰是某机密部门的打字员,她现在接到一个任务:需要在一天之内输入几百个长度固定为6的密码。当然,她希望输入的过程中敲击键盘的总次数越少越好。不幸的是,出于保密的需要,该部门用于输入密码的键盘是特殊设计的,键盘上没有数字键,而只有以下六个键:Swap0, Swap1, Up, Down, Left, Right。为了说明这6个键的作用,我们先定义录入区的6个位置的编号,从左至右依次为1,2,3,4,5,6。下面列出每个键的作用:Swap0:按Swap0,光标位置不变,将光标...

2022-05-05 21:07:11 157

原创 龙龙送外卖 (树上模拟)

问题:龙龙是“饱了呀”外卖软件的注册骑手,负责送帕特小区的外卖。帕特小区的构造非常特别,都是双向道路且没有构成环 —— 你可以简单地认为小区的路构成了一棵树,根结点是外卖站,树上的结点就是要送餐的地址。每到中午 12 点,帕特小区就进入了点餐高峰。一开始,只有一两个地方点外卖,龙龙简单就送好了;但随着大数据的分析,龙龙被派了更多的单子,也就送得越来越累……看着一大堆订单,龙龙想知道,从外卖站出发,访问所有点了外卖的地方至少一次(这样才能把外卖送到)所需的最短路程的距离到底是多少?每次新增一个点外

2022-05-04 22:15:26 161

原创 生日蛋糕(深搜+剪枝)

问题7月17日是 Mr.W 的生日,ACM-THU 为此要制作一个体积为NπNπ的M层生日蛋糕,每层都是一个圆柱体。设从下往上数第i层蛋糕是半径为Ri,高度为Hi的圆柱。当i<M时,要求Ri>Ri+1且Hi>Hi+1。由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积QQ最小。令Q=Sπ,请编程对给出的N和M,找出蛋糕的制作方案(适当的Ri和Hi的值),使S最小。除Q...

2022-05-04 14:51:35 839

原创 埃及分数 (迭代深搜 TAT....入门)

描述在古埃及,人们使用单位分数的和(形如1/a的, a是自然数)表示一切有理数。如:2/3=1/2+1/6,但不允许2/3=1/3+1/3,因为加数中有相同的。对于一个分数a/b,表示方法有很多种,但是哪种最好呢?首先,加数少的比加数多的好,其次,加数个数相同的,最小的分数越大越好。如:19/45=1/3 + 1/12 + 1/18019/45=1/3 + 1/15 + 1/4519/45=1/3 + 1/18 + 1/30,19/45=1/4 + 1/6 + 1/18019/45=

2022-05-03 22:36:25 2251

原创 电路维修 (双端队列 + dijkstra)

Question达达是来自异世界的魔女,她在漫无目的地四处漂流的时候,遇到了善良的少女翰翰,从而被收留在地球上。翰翰的家里有一辆飞行车。有一天飞行车的电路板突然出现了故障,导致无法启动。电路板的整体结构是一个R行C列的网格(R,C≤500),如下图所示。每个格点都是电线的接点,每个格子都包含一个电子元件。电子元件的主要部分是一个可旋转的、连接一条对角线上的两个接点的短电缆。在旋转之后,它就可以连接另一条对角线的两个接点。电路板左上角的接点接入直流电源,右下角的接点接入飞行...

2022-05-01 21:48:23 143

原创 Palindrome Basis(回文数+ 完全背包)

Question:You are given a positive integer n. Let's call some positive integer a without leading zeroes palindromic if it remains the same after reversing the order of its digits. Find the number of distinct ways to express n as a sum of positive palindro

2022-05-01 00:52:01 348

原创 Tree Traversals(PAT甲级 ,树的简单操作)

Question:Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree.Input Specificatio

2022-04-30 22:30:25 336

原创 Best Cow Fences (前缀和 + 二分)

描述Farmer John's farm consists of a long row of N (1 <= N <= 100,000)fields. Each field contains a certain number of cows, 1 <= ncows <= 2000.FJ wants to build a fence around a contiguous group of these fields in order to maximize the averag

2022-04-30 16:06:04 2169

原创 八数码 (Astar)

题目描述在一个3×3的网格中,1∼8这8个数字和一个X恰好不重不漏地分布在这3×3的网格中。例如:1 2 3X 4 67 5 8在游戏过程中,可以把X与其上、下、左、右四个方向之一的数字交换(如果存在)。我们的目的是通过交换,使得网格变为如下排列(称为正确排列):1 2 34 5 67 8 X例如,示例中图形就可以通过让X先后与右、下、右三个方向的数字交换成功得到正确排列。交换过程如下:1 2 3 1 2 3 1 2 3 ...

2022-04-29 14:53:17 2900

原创 第K短路 (A star板子题)

问题给定一张N个点(编号1,2…N),M条边的有向图,求从起点S到终点T的第K短路的长度,路径允许重复经过点或边。注意:每条最短路中至少要包含一条边。输入格式第一行包含两个整数N和M。接下来M行,每行包含三个整数A,B和L,表示点A与点B之间存在有向边,且边长为L。最后一行包含三个整数S,T和K,分别表示起点S,终点T和第K短路。输出格式输出占一行,包含一个整数,表示第K短路的长度,如果第K短路不存在,则...

2022-04-29 12:20:18 465

原创 Boundary(找规律)

QuestionBethany would like to tile her bathroom. The bathroom has width w centimeters and length l centimeters. If Bethany simply used the basic tiles of size 1×1 centimeters, she would use w⋅l of them.However, she has something different in mind.On

2022-04-24 22:45:24 93

原创 回文日期 (思维)

描述在日常生活中,通过年、月、日这三个要素可以表示出一个唯一确定的日期。牛牛习惯用8位数字表示一个日期,其中,前4位代表年份,接下来2位代表月 份,最后2位代表日期。显然:一个日期只有一种表示方法,而两个不同的日期的表 示方法不会相同。牛牛认为,一个日期是回文的,当且仅当表示这个日期的8位数字是回文的。现 在,牛牛想知道:在他指定的两个日期之间包含这两个日期本身),有多少个真实存 在的日期是回文的。一个8位数字是回文的,当且仅当对于所有的i(1≤i≤8)从左向右数的第i个数字和第9−i个数字

2022-04-21 20:10:10 260

原创 红色警报 (暴力并查集)

题目描述:战争中保持各个城市间的连通性非常重要。本题要求你编写一个报警程序,当失去一个城市导致国家被分裂为多个无法连通的区域时,就发出红色警报。注意:若该国本来就不完全连通,是分裂的k个区域,而失去一个城市并不改变其他城市之间的连通性,则不要发出警报。输入格式:输入在第一行给出两个整数N(0 < N ≤ 500)和M(≤ 5000),分别为城市个数(于是默认城市从0到N-1编号)和连接两城市的通路条数。随后M行,每行给出一条通路所连接的两个城市的编号,其间以1个空格分隔。在城市信息之后给出

2022-04-20 22:43:18 72

空空如也

空空如也

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

TA关注的人

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