08 2018 档案

最小生成树模板&&总结--Prim&&Kruskal
摘要:一.最小生成树:连通N个点的边权值总和最小的树。 二.时间复杂度 Prim算法:时间复杂度O(|V|2+|E|),O(|E|log|V|) Kruskal算法:时间复杂度O(|E|log|E|) 算法的选择: 从图的稀疏程度考虑(稠密图Prim,稀疏图Kruskal或Prim + Heap) 三.具 阅读全文

posted @ 2018-08-07 17:27 一零七 阅读(189) 评论(0) 推荐(0)

H - 最小生成树模板+1(适合Prim) UVA - 10369
摘要:H - 最小生成树模板+1(适合Prim) UVA - 10369 The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two diff 阅读全文

posted @ 2018-08-07 17:18 一零七 阅读(158) 评论(0) 推荐(0)

G - 最小生成树模板(适合Kruskal) UVALive - 2515 Networking
摘要:G - 最小生成树模板(适合Kruskal) UVALive - 2515 You are assigned to design network connections between certain points in a wide area. You are given a set of poi 阅读全文

posted @ 2018-08-07 17:17 一零七 阅读(136) 评论(0) 推荐(0)

C++STL 优先队列priority_queue使用
摘要:头文件:#include <queue> 一.申明方式 struct cmp { bool operator ()(int x, int y) { return x > y; // 小的优先级高 } }; priority_queue<int, vector<int>, cmp> q; 3.友元函数 阅读全文

posted @ 2018-08-07 12:20 一零七 阅读(1369) 评论(0) 推荐(0)

ACM一些小的注意事项 持续更新ing
摘要:一.关于浮点数的输入输出 scanf :floot : %f     double : %lf    long double : %Lf printf :floot : %f     double : %f(用%lf的话会出很多奇奇怪怪的问题,poj好像必须用%f,不然wa(惨痛教训,bug找了半天,没想到是错在这))    long double : %Lf 二.1.Java 类名称必须为Main 2.java中字符串String是不可以修改的,要修改只能转换为字符数组. 三.memset函数:很多数都不能直接用memset赋值,因为memset是一个字节一个字节赋值的。(所以若要赋值的那个数转成2进制之后每个字节都是一样的话才能用memset) 可行: memset(a,0,sizeof(a))//因为0低8为00000000,而32位就是32个0 memset(a,-1,sizeof(a))//因为1低8为11111111,而32位就是32个1 memset(a,0x3f3 阅读全文

posted @ 2018-08-07 10:53 一零七 阅读(343) 评论(0) 推荐(0)

ACM数学常用知识整理(持续更新ing)
摘要:1.最大公约数,最小公倍数 int gcd(int x,int y) { int z=y; while(x%y!=0) { z=x%y; x=y; y=z; } return z; } int lcm(int x,int y) { return x*y/gcd(x,y); } 2.快速幂 1 int 阅读全文

posted @ 2018-08-07 09:38 一零七 阅读(1177) 评论(0) 推荐(0)

E - 带删除并查集 UVA - 11987 Almost Union-Find
摘要:UVA - 11987 Almost Union-Find I hope you know the beautiful Union-Find structure. In this problem, you’re to implement something similar, but not iden 阅读全文

posted @ 2018-08-06 16:23 一零七 阅读(195) 评论(0) 推荐(1)

B - 简单带权并查集 POJ - 2492 A Bug's Life
摘要:POJ - 2492 http://poj.org/problem?id=2492 Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that th 阅读全文

posted @ 2018-08-06 11:25 一零七 阅读(145) 评论(0) 推荐(0)

H - 因为司是一个容易让自己去忍受的人 HDU - 6201 transaction transaction transaction 树形DP
摘要:H - 因为司是一个容易让自己去忍受的人 HDU - 6201 Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a grea 阅读全文

posted @ 2018-08-05 15:57 一零七 阅读(182) 评论(0) 推荐(0)

F - 你这是第一次让我看到落泪了呢 POJ - 3661Running 区间DP
摘要:F - 你这是第一次让我看到落泪了呢 POJ - 3661 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10... 阅读全文

posted @ 2018-08-05 11:56 一零七 阅读(150) 评论(0) 推荐(0)

E - 在摩天轮转完这一圈结束掉,好吗? HDU - 1561 The more, The Better 树形DP
摘要:E - 在摩天轮转完这一圈结束掉,好吗? HDU - 1561 ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克... 阅读全文

posted @ 2018-08-05 09:57 一零七 阅读(148) 评论(0) 推荐(0)

2018"百度之星"程序设计大赛 - 资格赛 1001 调查问卷 二进制状态压缩
摘要:调查问卷 Accepts: 401 Submissions: 1731 Time Limit: 6500/6000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Problem Descr... 阅读全文

posted @ 2018-08-04 16:18 一零七 阅读(139) 评论(0) 推荐(0)

2018"百度之星"程序设计大赛 - 资格赛 1002 子串查询
摘要:子串查询 Accepts: 1262 Submissions: 5335 Time Limit: 3500/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Problem Desc... 阅读全文

posted @ 2018-08-04 16:05 一零七 阅读(137) 评论(0) 推荐(0)

J - Chores POJ - 1949 Chores 树形DP
摘要:J - Chores POJ - 1949 Farmer John's family pitches in with the chores during milking, doing all the chores as quickly as possible. At ... 阅读全文

posted @ 2018-08-03 15:25 一零七 阅读(181) 评论(0) 推荐(0)

I - Bone Collector HDU - 2602 Bone Collector 01背包
摘要:I - Bone Collector HDU - 2602 Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to c... 阅读全文

posted @ 2018-08-03 11:45 一零七 阅读(86) 评论(0) 推荐(0)

H - Piggy-Bank HDU - 1114 Piggy-Bank 完全背包
摘要:H - Piggy-Bank HDU - 1114 Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main... 阅读全文

posted @ 2018-08-03 11:25 一零七 阅读(131) 评论(0) 推荐(0)

G - Bridging signals POJ - 1631 Bridging signals 最长上升子序列 贪心+二分
摘要:G - Bridging signals POJ - 1631 'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the ... 阅读全文

posted @ 2018-08-03 10:41 一零七 阅读(174) 评论(0) 推荐(0)

F - Anniversary party HDU - 1520 Anniversary party 树形DP
摘要:F - Anniversary party HDU - 1520 There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The Uni... 阅读全文

posted @ 2018-08-03 09:55 一零七 阅读(106) 评论(0) 推荐(0)

E - Longest Regular Bracket Sequence CodeForces - 5C DP+栈
摘要:E - Longest Regular Bracket Sequence CodeForces - 5C This is yet another problem dealing with regular bracket sequences.We should remi... 阅读全文

posted @ 2018-08-03 09:42 一零七 阅读(171) 评论(0) 推荐(0)

K - UZI HDU - 2102 A计划 搜索
摘要:K - UZI HDU - 2102 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习... 阅读全文

posted @ 2018-08-02 17:40 一零七 阅读(76) 评论(0) 推荐(0)

J - 最强王者 POJ - 1753 Flip Game 搜索+状态压缩
摘要:J - 最强王者 POJ - 1753 Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of... 阅读全文

posted @ 2018-08-02 17:39 一零七 阅读(91) 评论(0) 推荐(0)

I - 超凡大师 CSU - 2031: Barareh on Fire
摘要:I - 超凡大师 CSU - 2031 The Barareh village is on fire due to the attack of the virtual enemy. Several places are already on fire and the ... 阅读全文

posted @ 2018-08-02 17:38 一零七 阅读(82) 评论(0) 推荐(0)

H - 钻石 CSU - 1224: ACM小组的古怪象棋 搜索
摘要:H - 钻石 CSU - 1224 ACM小组的Samsara和Staginner对中国象棋特别感兴趣,尤其对马(可能是因为这个棋子的走法比较多吧)的使用进行深入研究。今天他们又在 构思一个古怪的棋局:假如Samsara只有一个马了,而Staginner又只剩下一个将... 阅读全文

posted @ 2018-08-02 17:36 一零七 阅读(95) 评论(0) 推荐(0)

E - 白银 CSU - 1726: 你经历过绝望吗?两次! 搜索
摘要:E - 白银 CSU - 1726 4月16日,日本熊本地区强震后,受灾严重的阿苏市一养猪场倒塌,幸运的是,猪圈里很多头猪依然坚强存活。当地15名消防员耗时一天解救围困的“猪坚强”。不过与在废墟中靠吃木炭饮雨水存活36天的中国汶川“猪坚强”相比,熊本的猪可没那么幸运,... 阅读全文

posted @ 2018-08-02 17:34 一零七 阅读(102) 评论(0) 推荐(0)

D - 青铜一 HDU - 1429 胜利大逃亡(续) BFS
摘要:D - 青铜一 HDU - 1429 Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)…… 这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx... 阅读全文

posted @ 2018-08-01 14:04 一零七 阅读(107) 评论(0) 推荐(0)

C - 青铜五 HDU - 2717 Catch That Cow BFS
摘要:C - 青铜五 HDU - 2717 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a ... 阅读全文

posted @ 2018-08-01 12:40 一零七 阅读(118) 评论(0) 推荐(0)

B - 小学生 POJ - 3126 Prime Path
摘要:B - 小学生 POJ - 3126 The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all... 阅读全文

posted @ 2018-08-01 12:34 一零七 阅读(134) 评论(0) 推荐(0)

A - 刚入坑 ZOJ - 1709 Oil Deposits BFS
摘要:A - 刚入坑 ZOJ - 1709 The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works w... 阅读全文

posted @ 2018-08-01 12:29 一零七 阅读(169) 评论(0) 推荐(0)

I - 剪枝 0。O HDU - 1455 Sticks DFS
摘要:I - 剪枝 0。O HDU - 1455 George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he... 阅读全文

posted @ 2018-08-01 12:20 一零七 阅读(97) 评论(0) 推荐(0)

H - 连通分量 POJ - 3620 Avoid The Lakes DFS水题
摘要:H - 连通分量 POJ - 3620 Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows a... 阅读全文

posted @ 2018-08-01 11:50 一零七 阅读(112) 评论(0) 推荐(0)

F - DFS枚举 CSU - 2087: Tragedy Words
摘要:F - DFS枚举 CSU - 2087 As is known to all, Wells doesn't have a good command of English. As a result, some unfamiliar words, which may c... 阅读全文

posted @ 2018-08-01 11:40 一零七 阅读(136) 评论(0) 推荐(0)

D - Prime Ring Problem HDU - 1016 DFS水题
摘要:D - Prime Ring Problem HDU - 1016 A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle... 阅读全文

posted @ 2018-08-01 11:27 一零七 阅读(179) 评论(0) 推荐(0)

A - 后序遍历 HihoCoder - 1049
摘要:A - 后序遍历 HihoCoder - 1049 描述在参与过了美食节之后,小Hi和小Ho在别的地方又玩耍了一阵子,在这个过程中,小Ho得到了一个非常有意思的玩具——一棵由小球和木棍连接起来的二叉树!小Ho对这棵二叉树爱不释手,于是给它的每一个节点都标记了一个标号—... 阅读全文

posted @ 2018-08-01 11:10 一零七 阅读(135) 评论(0) 推荐(0)

E - ( ;´Д`) URAL - 1081 Binary Lexicographic Sequence 递归
摘要:E - ( ;´Д`) URAL - 1081 Consider all the sequences with length (0 #include #include #include #include typedef long long LL;using name... 阅读全文

posted @ 2018-08-01 10:49 一零七 阅读(129) 评论(0) 推荐(0)

导航