自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

peach_yang的博客

算法 ACM

  • 博客(16)
  • 收藏
  • 关注

原创 UVA 1572 Self-Assembly(拓扑排序)

Question:题目详情(http://vjudge.net/contest/133965#problem/F) 题目大意:有些种类的正方形,每条边有两个符号,‘00‘’不能与任何边相连,只有字母相同,“+-”相反才能相连,让判断是否用这些已有的正方形铺成无限大的平面 解题思路:将字母装华为数字例如A+A-转化为2n,2n+1,这样如果一个正方形x(A+)能和另一个正方形y(A-)相连,则正方

2016-09-30 07:35:54 493

原创 UVA 10562 Undraw the Trees

Question:题目详情(http://vjudge.net/contest/133965#problem/D) 题目大意:让你根据输入建图,并输出前序遍历,每个节点下有’|’ 则证明有子树,每棵树以‘#’结束 解题思路:如果一个节点下有‘|’则找到它下两行最左边的‘-’符号,从哪里访问,关键是读入当时学习了一下#include <iostream>#include <cstdio>#in

2016-09-29 23:50:10 204

原创 UVA 10129 Play on Words(欧拉回路)

Question:题目详情(http://vjudge.net/contest/133965#problem/C) 题目大意:有很多单词,要你把他们排列成一个单词的末尾为下一个单词的首字母,问这么排列是否可行 解题思路:根据题意建立一个无向图(一个单词的首尾字母关系),判断图中是否存在欧拉回路,判断欧拉路径的方法两个因素:1。图必须连通(并查集,dfs可执行),2。出入度数必须满足每个节点的入度

2016-09-29 23:06:12 265

原创 UVA 572 Oil Deposits(DFS)

Question:题目详情(http://vjudge.net/contest/133965#problem/B) 题目大意:有一个矩阵,矩阵中的只要相邻或者对角线的‘@’符号都可以算作一个连通集,问有多少个连通集 解题思路:这道题是典型的dfs#include <iostream>#include <cstdio>#include <cstring>#include <string>#

2016-09-29 22:37:57 223

原创 UVA 297 Quadtrees(四叉树)

Question: A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split in

2016-09-27 21:55:08 377

原创 UVA 699 The Falling Leaves(二叉树)

Question: Each year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the trees. If the sa

2016-09-27 21:34:59 343

原创 UVA 839 Not so Mobile(二叉树经典题)

Question; Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually found hanging over cra

2016-09-27 21:22:20 253

原创 UVA 548 Tree(二叉树建树)

Question: You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path i

2016-09-27 21:09:44 339

原创 UVA 679 Dropping Balls(二叉树)

Question: A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving down,

2016-09-27 20:59:08 228

原创 UVA 12657 Boxes in a Line(双向链表)

Question: 12657 Boxes in a Line You have n boxes in a line on the table numbered 1 … n from left to right. Your task is to simulate 4 kinds of commands: • 1 X Y : move box X to the left to Y (ignor

2016-09-08 14:06:02 241

原创 UVA 11988 Broken Keyboard (a.k.a. Beiju Text)(破损的键盘(又名:悲剧的文本))(链表)

Question: Broken Keyboard (a.k.a. Beiju Text) You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or t

2016-09-08 13:50:51 407

原创 UVA 442 Matrix Chain Multiplication(栈)

Question: Matrix Chain Multiplication Suppose you have to evaluate an expression like A*B*C*D*E where A,B,C,D and E are matrices. Since matrix multiplication is associative, the order in which mult

2016-09-08 13:32:40 248

原创 UVA 514 Rails(栈)

Question: Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time.

2016-09-08 13:21:17 257

原创 Gym 100712F Travelling Salesman

Question: After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends most of his time travelling between different cities. He decided to buy a new car to help him in his job, but he h

2016-09-05 23:00:01 341

原创 UVALive 6832 Bit String Reordering

Question: You have to reorder a given bit string as specified. The only operation allowed is swapping adjacent bit pairs. Please write a program that calculates the minimum number of swaps required.

2016-09-05 22:50:43 375

原创 UVALive 6834 Shopping(开箱拿钥匙题型)

Question: Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop has one do

2016-09-05 22:42:04 369

空空如也

空空如也

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

TA关注的人

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