UVA
文章平均质量分 82
peach_yang
这个作者很懒,什么都没留下…
展开
-
UVA 11609 Teams
Question: In a galaxy far far away there is an ancient game played among the planets. The specialty of the game is that there is no limitation on the number of players in each team, as long as there原创 2016-07-22 20:17:28 · 326 阅读 · 0 评论 -
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 · 242 阅读 · 0 评论 -
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 · 384 阅读 · 0 评论 -
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 · 231 阅读 · 0 评论 -
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 · 216 阅读 · 0 评论 -
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 · 312 阅读 · 0 评论 -
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 · 246 阅读 · 0 评论 -
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 · 324 阅读 · 0 评论 -
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 · 359 阅读 · 0 评论 -
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 · 216 阅读 · 0 评论 -
UVA 10129 Play on Words(欧拉回路)
Question:题目详情(http://vjudge.net/contest/133965#problem/C) 题目大意:有很多单词,要你把他们排列成一个单词的末尾为下一个单词的首字母,问这么排列是否可行 解题思路:根据题意建立一个无向图(一个单词的首尾字母关系),判断图中是否存在欧拉回路,判断欧拉路径的方法两个因素:1。图必须连通(并查集,dfs可执行),2。出入度数必须满足每个节点的入度原创 2016-09-29 23:06:12 · 255 阅读 · 0 评论 -
UVA 10562 Undraw the Trees
Question:题目详情(http://vjudge.net/contest/133965#problem/D) 题目大意:让你根据输入建图,并输出前序遍历,每个节点下有’|’ 则证明有子树,每棵树以‘#’结束 解题思路:如果一个节点下有‘|’则找到它下两行最左边的‘-’符号,从哪里访问,关键是读入当时学习了一下#include <iostream>#include <cstdio>#in原创 2016-09-29 23:50:10 · 197 阅读 · 0 评论 -
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 · 429 阅读 · 0 评论 -
Knight Moves(BFS)
Question:题目详情(http://vjudge.net/contest/135927#problem/A) 题目大意:在一个棋盘上横坐标为1~8,纵坐标为a~g,给你一个起点高一个终点,让你用中国象棋的马走日算出起点到终点的最短步数 解题思路:这就是一道简单的bfs的题,只是跟以往的不同的是这次是“马走日”,其余的没什么不同#include <iostream>#include <cs原创 2016-10-17 21:47:10 · 661 阅读 · 0 评论 -
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 · 231 阅读 · 0 评论 -
Paintball(dfs判断连通)
Question:题目详情(http://vjudge.net/contest/134361#problem/C) 题目大意:有一个1000*1000的方阵(建立坐标),这之间有一些士兵有具体的坐标,并且具有一定的攻击半径,现你要从最左边进入,途中避开所有的士兵(不被攻击),从最右边出,如果有多解则输出离北边最近的额坐标 解题思路:可以把士兵看成一个个圆,看成池塘的石头,如果能从池塘的最北边走石原创 2016-10-09 23:50:12 · 298 阅读 · 0 评论 -
Parentheses Balance(栈)
Question:题目详情(http://vjudge.net/contest/134361#problem/D) 题目大意:只有()[] 四种字符,空串为平衡,()[]都为平衡,平衡里面嵌套平衡也是平衡的 解题思路:用一个栈遇到’ [ ‘,’(‘时就推入遇到’ )” ] ‘时就与栈顶匹配,如果能匹配就婆婆,最终判断栈是否为空,如为空则平衡,否则不平衡。但注意:))))]]]这种情况用上述方法原创 2016-10-09 23:31:54 · 332 阅读 · 0 评论 -
UVA 11076 Add Again
Question: Summation of sequence of integers is always a common problem in Computer Science. Rather than computing blindly, some intelligent techniques make the task simpler. Here you have to find the原创 2016-07-22 19:55:53 · 237 阅读 · 0 评论 -
UVA 11538 Chess Queen
Question: You probably know how the game of chess is played and how chess queen operates. Two chess queens are in attacking position when they are on same row, column or diagonal of a chess board. Su原创 2016-07-22 22:02:17 · 215 阅读 · 0 评论 -
UVA 10791 Minimum Sum LCM
Question: LCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is a multiple of all integers of that set. It is interesting to note that any positive integer can b原创 2016-07-22 20:56:46 · 208 阅读 · 0 评论 -
UVA 11401 Triangle Counting
Question: You are given n rods of length 1, 2, … , n. You have to pick any 3 of them and build a triangle. How many distinct triangles can you make? Note that, two triangles will be considered differ原创 2016-07-22 22:57:41 · 227 阅读 · 0 评论 -
UVA11889 Benefit
Question: Recently Yaghoub is playing a new trick to sell some more. When somebody gives him A Tomans, he who never has appropriate changes, asks for B Tomans such that lowest common multiple of A an原创 2016-07-18 19:58:42 · 407 阅读 · 0 评论 -
UVA 10943 HOW do you add?
Question; Larry is very bad at math — he usually uses a calculator, which worked well throughout college. Unforunately, he is now struck in a deserted island with his good buddy Ryan after a snowboa原创 2016-07-18 20:15:17 · 309 阅读 · 0 评论 -
UVA 11489 I - Integer Game
Qustion: Two players, S and T, are playing a game where they make alternate moves. S plays first. In this game, they start with an integer N. In each move, a player removes one digit from the intege原创 2016-07-18 23:13:56 · 196 阅读 · 0 评论 -
UVA 11461 K - Square Numbers
Question: A square number is an integer number whose square root is also an integer. For example 1, 4, 81 are some square numbers. Given two numbers a and b you will have to find out how many square原创 2016-07-18 23:30:32 · 338 阅读 · 0 评论 -
UVA 10780 C - Again Prime? No Time.
Question: The problem statement is very easy. Given a number n you have to determine the largest power of m, not necessarily prime, that divides n!. Input The input file consists of several test ca原创 2016-07-18 23:47:38 · 289 阅读 · 0 评论 -
UVA 10892 LCM Cardinality
Question: A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible pairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4) etc. For a given positive integer原创 2016-07-22 19:40:54 · 264 阅读 · 0 评论 -
UVA 11806 Cheerleaders
Question: In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup socc原创 2016-08-29 15:28:01 · 339 阅读 · 0 评论 -
Tree Recovery(二叉树建树,后序遍历)
Question:题目详情(http://vjudge.net/contest/134361#problem/F) 题目大意:给你一棵树的前序遍历和中序遍历,让你输出后序遍历 解题思路:就单纯的建树并输出后序遍历即可#include <iostream>#include <cstdio>#include <cstring>using namespace std;char q[30],z[原创 2016-10-09 17:21:37 · 501 阅读 · 0 评论 -
S-Trees(二叉树)
Question:题目详情(http://vjudge.net/contest/134361#problem/E) 题目大意:有一个n层的满二叉树,每个子节点都对应了一个确定的值(共2^n个),有m个访问值,每个访问值由n个0,1组成,0表示走左子节点,1表示走右子节点,这样每个访问值都对应了原二叉树的子节点的一个确定的值,最后输出m个访问值 解题思路:先用一个数组保存下2^n个节点的值,然后将原创 2016-10-09 23:19:58 · 1387 阅读 · 0 评论 -
Patrol Robot(BFS)
Question:题目详情(http://vjudge.net/contest/135927#problem/B) 题目大意:从一个矩阵的左上角到右下角的最短步数,但方阵中有一些有障碍,机器人只能连续穿过最多k个墙,如不能则输出-1 解题思路:开始时就想到的事bfs,但要考虑穿过的墙数目,所以就不知道怎么做了,但后来想到可以通过vis三维变量来标记,第三维表示到这个点的各个墙数是否被访问过,这样原创 2016-10-17 22:05:12 · 381 阅读 · 0 评论