UVa
Jianquan520
这个作者很懒,什么都没留下…
展开
-
UVa 401 Palindromes 字符串基础
题目链接:http://acm.hust.edu.cn:8080/judge/problem/viewProblem.action?id=19520题目大意:给你一个字符串,一要你判断是否是回文串;二要把这个字符串的每一个字符按照给定的规则翻转,而然后判断翻转后的字符串是否是原串的逆序。 思路不难,但是有些地方要注意。首先要注意的一个问题是,大写字母O和数字0是一样的。这一点我觉得题...2012-08-06 00:00:23 · 131 阅读 · 0 评论 -
Uva 10098 Generating Fast
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=1039[/url]具体思路请参考刘汝佳的《算法竞赛入门经典》7.2.2生成可重集的排列[code="C"]#include#include#inc...2012-08-23 15:28:22 · 114 阅读 · 0 评论 -
UVa 729 The Hamming Distance Problem
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=670[/url]枚举十进制数0~2^N-1,对于每一个数都跟0异或,并把异或的结果转换成二进制,计算二进制数中1的个数,如果等于H,那么把该二进制数输出,注意不要忽略了前导零。[cod...2012-08-24 12:18:38 · 159 阅读 · 0 评论 -
UVa 131 The Psychic Poker Player
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=67[/url]对于每一个输入样例(10张牌),我们要构造出它所有的32种牌型组合,这是一个比较困难的地方,方法是用递归枚举。每次我们可以从手牌中分别选取0~5张牌...2012-08-24 22:28:01 · 143 阅读 · 0 评论 -
UVa 11205 The broken pedometer
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2146[/url]题目大意是求最少的工作正常的LED(一条横杠或竖杠代表一个正常的LED)能够表示出题目给定的所有数字。LED最大数目是15,每一条LED要么亮(正常)要么不亮(不正常),...2012-08-25 17:28:38 · 210 阅读 · 0 评论 -
UVa 592 Island of Logic
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=533[/url]人数最多只有5个人,加上时间,所以可以用6个循环枚举所有的情况。输入的时候可以根据某个特定的字符去判断这个陈述的内容,比如带有'd'的是'divine'。判断该陈述...2012-08-27 11:05:12 · 155 阅读 · 0 评论 -
UVa 10474 Where is the Marble?
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=1415[/url]快排+二分,就是不知道跟回溯法有什么关系。[code="C"]#include#include#define MAXN 1000...2012-08-28 13:45:35 · 129 阅读 · 0 评论 -
UVa 216 Getting in Line
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=152[/url]最多只有8个点,枚举所有的排列即可,可以用一个二维数组记录所有的排列以便最后输出。这道题目是一道水题,但是它的题目描述有点复杂,所以需要一点耐心去读懂题意。有两点可以从...2012-08-29 20:48:02 · 141 阅读 · 0 评论 -
UVa 639 Don't Get Rooked
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=580[/url]最多16个格,2^16=65536可以枚举完,而且很多都是可以剪枝的,用dfs枚举就可以。要注意的是如果在dfs之前用vis数组标记放下了“车”,那么要在dfs之后清除...2012-08-30 23:01:44 · 117 阅读 · 0 评论 -
UVa 146 ID Codes
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=82[/url]题目的要求是找出字典序中的下一个排列。从后往前查找,如果一直都是非递减的,那么就是“No Successor”。一旦发现不符合条件的字符(if(...2012-08-20 18:46:52 · 125 阅读 · 0 评论 -
UVa 10167 Birthday Cake
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=107&page=show_problem&problem=1108[/url]直接从-500到500枚举A和B,非常简单。 [code="cpp"]#include#include#include#de...2012-08-16 20:57:23 · 159 阅读 · 0 评论 -
UVa 10129 Play on Words
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=1070题目大意是给你一串单词,判断能否连接成一条长串,两个单词能够连接的条件是后一个单词的首字母与前一个单词的尾字母相同(单词至少有2个...原创 2012-08-15 22:49:32 · 113 阅读 · 0 评论 -
Uva 112 Tree Summing 二叉树
题目链接:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=48[/url]主要思路:这道题目的难点在于如何把题目所给的输入数据转换成一棵树。首先定义一个字符型的变量c,再定义一个整型的变量num。因为开始一定是'(',所以先输入c(cin>>c...2012-08-09 00:35:14 · 90 阅读 · 0 评论 -
Uva 572 Oil Deposits
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=513比较简单的一道题目,主要用dfs搜索。可能比较难想的是在每次搜完之后怎么去寻找下一个起点,方法是做好标记,从头到尾每个点都搜一遍就可以了。#include<io...2012-08-11 11:43:09 · 100 阅读 · 0 评论 -
UVa 784 Maze Exploration
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=725这道题也是一道非常裸的dfs#include<iostream>#include<cstdio>#include<string&...2012-08-11 14:09:50 · 154 阅读 · 0 评论 -
Uva 439 Knight Moves
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=380题目大意是在一个网格中(行编号从1~8,列编号从a~h),给你两个点,要你找出象棋中的马从一个点跳到另一个点的最少步数。是一道十分基础的...2012-08-11 22:24:27 · 125 阅读 · 0 评论 -
Uva 532 Dungeon Master
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=473这道题也是一道很基础的bfs,仅仅是图从二维变成三维在入队列之前进行判断比出队列之后再进行判断会节约运行的时间,因为减少了入队、...2012-08-13 23:29:56 · 98 阅读 · 0 评论 -
Uva 10004 Bicoloring
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=945主要用dfs#include<iostream>#include<cstdio>#include...2012-08-13 23:34:00 · 119 阅读 · 0 评论 -
Uva 10305 Ordering Tasks
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=1246拓扑排序,直接dfs,具体看刘汝佳的《算法竞赛入门经典》。而且这道题目的题意是一定存在拓扑排序,所以更加简单。#include...2012-08-13 23:40:54 · 87 阅读 · 0 评论 -
UVa 10596 Morning Walk
题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=105&problem=1537&mosmsg=Submission+received+with+ID+10476587无向图的欧拉回路。先判断连通性,从...2012-08-14 22:05:51 · 115 阅读 · 0 评论 -
UVa 10422 Knights in FEN
题目:[url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1363[/url][code="cpp"]#include#include#include#includeusing namespace std;struct ...2012-09-07 08:40:00 · 141 阅读 · 0 评论