- 博客(33)
- 收藏
- 关注
原创 pyreverse:Python自动生成类图
pyreverse:Python自动生成类图本文针对Windows。1 安装pyreverse:http://www.graphviz.org/ 官网中下载pip install pylint
2021-02-27 13:20:23 980
原创 拓扑排序 POJ1128 Frame Stacking
拓扑排序 POJ1128 Frame Stacking拓扑排序: 有向无环图的拓扑排序 基本算法: 无前驱的定点优先Turpo排序算法是每一步总输出当前无前驱(入度为零)的定点。 (1)从有向图中选择一个没有前驱的顶点并输出它 (2)从网中删除该顶点,并删除从该定点出发的所有有向边和有向边链接的对应顶点 (3)重复上述步骤直到剩余网络中不再存在没有前驱的顶点性质: (1)剩余
2018-01-07 10:28:07 206
原创 NOIPDay1T2时间复杂度
NOIPDay1T2时间复杂度题目描述小明正在学习一种新的编程语言 A++,刚学会循环语句的他激动地写了好多程序并 给出了他自己算出的时间复杂度,可他的编程老师实在不想一个一个检查小明的程序, 于是你的机会来啦!下面请你编写程序来判断小明对他的每个程序给出的时间复杂度是否正确。A++语言的循环结构如下:F i x y 循环体E其中F i x y表示新建变量 iii(变量 ii
2017-12-03 14:36:45 432
原创 树状结构学习(1)、最大-最小划分树
树状结构学习(1)、最大-最小划分树有这样一类题: 给一棵n个点的树,要求将它分成k个子树,使权值和最小的子树权值和尽量大。 解法一:二分答案 我们知道,如果已知权值下限,我们可以从下往上搜以O(n)的复杂度判断是否可以分成k个权值大于权值下限的子树。 缺点:没有真正解出这道题,如果权值是实数或很大将会使这种方法失效。#include <iostream>#include <cmath>
2017-11-04 17:51:39 894
原创 Problem A Succession
Problem A SuccessionNCPC 2010 Problem A: Succession 1Problem ASuccessionThe king in Utopia has died without an heir. Now several nobles in the country claim the throne. The country law states that i
2017-11-03 19:21:41 952
原创 NOIP2016 DAY1T2 天天爱跑步
NOIP2016 DAY1T2 天天爱跑步描述小C同学认为跑步非常有趣,于是决定制作一款叫做《天天爱跑步》的游戏。《天天爱跑步》是一个养成类游戏,需要玩家每天按时上线,完成打卡任务。这个游戏的地图可以看作一棵包含n个结点和n - 1条边的树,每条边连接两个结点,且任意两个结点存在一条路径互相可达。树上结点编号为从1到n的连续正整数。现在有m个玩家,第i个玩家的起点为Si,终点为Ti。每天打卡任
2017-11-02 21:26:50 386 1
原创 SPOJ - PT07J Query on a tree III主席树
SPOJ - PT07J Query on a tree III 主席树You are given a node-labeled rooted tree with n nodes. Define the query (x, k): Find the node whose label is k-th largest in the subtree of the node x. Assume no tw
2017-11-01 07:32:47 199
原创 SPOJ - QTREE2 Query on a tree II树链剖分
SPOJ - QTREE2 Query on a tree IIYou are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned to it, representing
2017-10-30 16:50:39 196
原创 SPOJ - QTREE Query on a tree树链剖分
SPOJ - QTREE Query on a tree树链剖分 You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3…N-1. We will ask you to perfrom some instructions of the fol
2017-10-29 21:22:24 238
原创 POJ1204-Word Puzzles
POJ1204-Word Puzzles Word Puzzles Time Limit: 5000MS Memory Limit: 65536K Special Judge Description Word puzzles are usually simple and very entertaining for all ages. They are so ente
2017-10-29 08:58:55 355
原创 pojKMP专题:poj1961-Period poj2409-Power Strings poj2752-Seek the Name, Seek the Fame poj3461-Oulipo
pojKMP专题:poj1961-Period poj2409-Power Strings poj2752-Seek the Name, Seek the Fame poj3461-Oulipopoj3461-Oulipo Oulipo Time Limit: 1000MS Memory Limit: 65536K Description The French auth
2017-10-28 09:59:36 281
原创 Boxes of Chocolates Again UVA - 10590
Boxes of Chocolates Again UVA - 10590题目:https://odzkskevi.qnssl.com/7ee6f54041617f8f28cf81ea4c0484ec?v=1508356293数的划分。 描述状态:f[i][j]:数i划分数不超过j的种树 状态转移方程: f[i][j] = f[i][j-1]+f[i-j][j] 数i划分数不超过j的种树
2017-10-19 20:41:20 271
原创 POJ2396 Budget
POJ2396 Budget Budget Time Limit: 3000MS Memory Limit: 65536K Special Judge Description We are supposed to make a budget proposal for this multi-site competition. The budget proposal i
2017-10-17 18:29:00 297
原创 poj1144-Network
poj1144-Network Network Time Limit: 1000MS Memory Limit: 10000K Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several place
2017-10-14 11:09:09 400
原创 poj2186-Popular Cows
poj2186-Popular Cows Popular Cows Time Limit: 2000MS Memory Limit: 65536K Description Every cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) co
2017-10-14 11:07:05 152
原创 poj1041-John's trip
poj1041-John’s trip John’s trip Time Limit: 1000MS Memory Limit: 65536K Special Judge Description Little Johnny has got a new car. He decided to drive around the town to visit his frie
2017-10-14 10:20:56 264
原创 poj3207-Ikki's Story IV - Panda's Trick
poj3207-Ikki’s Story IV - Panda’s Trick Ikki’s Story IV - Panda’s Trick Time Limit: 1000MS Memory Limit: 131072K Description liympanda, one of Ikki’s friend, likes playing games with Ikki
2017-10-14 10:15:59 232
原创 poj2485-Highways
poj2485-Highways求最小生成树的最大边。 Prim算法:每次将到已有的生成树点集距离最小的点加入到生成树点集中。时间复杂度:O(|E|log|V|)#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <queue>using n
2017-10-14 09:39:10 356
原创 poj3487-The Stable Marriage Problem
poj3487-The Stable Marriage ProblemThe Stable Marriage ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3084Accepted: 1311DescriptionThe stable marriage problem consists of matching
2017-10-14 09:21:54 440 1
原创 poj3565-Ants
poj3565-Ants Ants Time Limit: 5000MS Memory Limit: 65536K Special Judge Description Young naturalist Bill studies ants in school. His ants feed on plant-louses that live on apple trees
2017-10-13 20:41:49 223
原创 特殊图poj2367-Genealogical tree poj-1776Task Sequences BZOJ1006: [HNOI2008]神奇的国度
特殊图poj2367-Genealogical tree poj-1776Task Sequences BJOJ1006: [HNOI2008]神奇的国度分类: 树:无环联通图 平面图:边没交点 平面图的对偶图:平面图网络流转化为最短路 有向无环图 二分图 正则图:任意俩顶点度数相同 弦图:图中任意长度大于3的环都含一条弦 竞赛图:任意两点间有切仅有一条有向边算法: 拓扑排序 O
2017-10-08 21:18:29 274
原创 SCUT第四次训练赛(归并排序 sort 搜索 搜索2 并查集 高精度乘法 二分 Dating with girls(1) 均分纸牌 导弹拦截 A + B Problem II)
SCUT第四次训练赛(归并排序 sort 搜索 搜索2 并查集 高精度乘法 二分 Dating with girls(1) 均分纸牌 导弹拦截 A + B Problem II)https://acm.scut.space/vJudge/contest/id/12 归并排序:求逆序对#include <iostream>#include <cstdio>#include <cstring>
2017-10-08 09:01:32 234
原创 poj1469-COURSES
poj1469-COURSES COURSES Time Limit: 1000MS Memory Limit: 10000K Description Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task
2017-10-07 11:32:43 170
原创 左偏树
左偏树实现最大优先队列,并实现排序。 左偏树: 性质: (1)左偏树根节点s值不超过log(|v|) (2)左偏树可并 (3)如果规定空结点s值为-1,那么每个点的s值等于其有儿子的s值+1 (4)每个结点右儿子s值总不大于左儿子s值精髓: 合并操作: (1)一个堆为空返回另一堆 (2)让x成为堆顶权值最大的树 (3)维护了l[x], r[x]的左偏树的性质 (4)父节点的d
2017-10-04 21:21:09 154
原创 poj3268-Silver Cow Party
(堆)poj3268-Silver Cow Party先是堆排练练手。 堆排序#include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 100000;const int INF = 0x7f
2017-10-04 08:27:54 297
原创 poj-3641Pseudoprime numbers
poj-3641Pseudoprime numbers Pseudoprime numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10836 Accepted: 4686 Description Fermat’s theorem states that for any prim
2017-10-02 16:58:33 190
原创 poj1595-Prime Cuts
poj1595-Prime Cuts(筛法求素数) Prime Cuts Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11684 Accepted: 4449 Description A prime number is a counting number (1, 2, 3, …) tha
2017-10-02 15:16:20 236
原创 51node-Bash game V1V2V3V4
51node-Bash gameV1V2V3V4Bash game v1: 有一堆石子共有N个。A B两个人轮流拿,A先拿。每次最少拿1颗,最多拿K颗,拿到最后1颗石子的人获胜。假设A B都非常聪明,拿石子的过程中不会出现失误。给出N和K,问最后谁能赢得比赛。 例如N = 3,K = 2。无论A如何拿,B都可以拿到最后1颗石子。解: 最基本的Bash game,显然,只有n % (k+
2017-10-02 08:40:26 477
原创 UVa10294 - Arif in Dhaka (First Love Part 2)
UVa10294 - Arif in Dhaka (First Love Part 2) Our hero Arif is now in Dhaka (Look at problem 10244 – First Love if you want to know more about Arif, but that information is not necessary for this prob
2017-10-01 14:38:27 261
原创 UVa10288 - Coupons
UVa10288 - Coupons Coupons in cereal boxes are numbered 1 to n, and a set of one of each is required for a prize (a cereal box, of course). With one coupon per box, how many boxes on average are requ
2017-09-30 21:53:02 365
原创 poj3111-K Best
poj 3111-K Best K Best Time Limit: 8000MSMemory Limit: 65536K Total Submissions: 11420Accepted: 2948 Case Time Limit: 2000MSSpecial Judge Description Demy has n jewels. Each of her jewels has
2017-09-29 21:27:45 184
原创 poj2065-SETI
poj2065-SETI#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 80;int MOD, n;char bri[MAXN];int a[MAXN][MAXN], ans[MA
2017-09-29 16:12:35 187
原创 poj3735-Training little cats
poj3735 Training little cats Training little cats Time Limit: 2000MSMemory Limit: 65536K Total Submissions: 14750Accepted: 3648 Description Facer’s pet cat just gave birth to a brood of little
2017-09-28 19:50:41 283
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人