
哈希
Joyyiwei
这个作者很懒,什么都没留下…
展开
-
uva 10887
题意:用set去重水过#include #include #include #include using namespace std;char str1[1500][20];char str2[1500][20];int main(){ int cas = 1; sets1; int t; scanf("%d",&t); while (t原创 2013-08-19 11:51:10 · 902 阅读 · 0 评论 -
uva 10591
题意:最大数字也就81*9,不会很大,那就简单了#include #include #include using namespace std;int sort(int x) { int y=0; while (x>0) { y=y+(x%10)*(x%10); x=x/10; }原创 2013-08-25 21:23:22 · 776 阅读 · 0 评论 -
uva 141
题意:往一个棋盘中放入棋子,或拿走棋子,如果当棋盘上的棋子摆放情况(旋转90度,150度,180度)出现过,那么他就输了,我们用set储存情况,但我们不是储存数字,所以我们要重载小于号#include #include #include #include using namespace std;const int MAXN = 100;struct Type{ bool k原创 2013-08-25 20:33:36 · 881 阅读 · 0 评论 -
uva 11198
题意:给你一个排列,让你排序成绝对值从小到达的最小步数,交换条件是,两位是异号,并且和为素数,看了别人的哈希,就用哈希保存所有的情况#include #include #include #include using namespace std;const int HashSize = 1000003 ;typedef int State[8];State start ;Sta原创 2013-08-25 20:58:56 · 948 阅读 · 0 评论 -
hdu 4287 水题
题意:求所给数在输入字符串的时候出现的次数,用hash映射,轻松。。#include #include #include using namespace std;int hash[1000005];int a[50005];char str[10];int judge(char c){ if('a'<=c&&c<='c') return 2;原创 2013-08-14 20:55:37 · 756 阅读 · 0 评论 -
uva 321
题意:十个房间让你走到第十个,条件是只有当房间是亮着的你才可以进去,每个房间都有相应的房间可以控制,我们用二进制来表示所有房间的亮灯情况,#include #include #include using namespace std;int Switch[12][12],stnum[12];int vis[100005],door[12][12];int r,d,s;struct n原创 2013-08-18 17:46:39 · 901 阅读 · 0 评论 -
uva 704
题意:起初愣是没看出序列的意思,右边转盘的最后三个是在左边的转盘上,看了别人的后才发现,如果单纯的从头bfs是会超时的,而我们可以通过双向的bfs搜索就可以解决了,#include #include #include #include #include using namespace std;int t;int judge;char pu[30];char start[30]原创 2013-08-18 17:52:35 · 880 阅读 · 0 评论 -
UVA - 12338 Anti-Rhyme Pairs (哈希)
DescriptionD Anti-Rhyme Pairs Input: Standard Input Output: Standard Output Often two words that rhyme also end in the same sequence of characters. We use原创 2014-08-13 18:33:28 · 1345 阅读 · 2 评论