统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 15526 Accepted Submission(s): 6643 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前…
Xor Sum 一遍A了之后大呼一声好(keng)题!debug了两小时~~~~百度之星资格赛,可以. 题意:给你一个n个元素的数组,m次查询,每次输入一个数k要求从数组中找到一个数与k异或值最大,输出这个数. 思路:因为拉的字典树专题,所以自然想到用字典树去想思路,手推了一下样例果然发现规律了,把这些数的二进制全部竖着列出来,不足高位补0,然后每次比较比较一个数,从高位开始比较,取其相反即可.于是可以用字典树把输入的数的二进制建树,查找只需转化成二进制然后再转成补码(字典树匹配),特别特别注意…
Repository Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2932 Accepted Submission(s): 1116 Problem Description When you go shopping, you can search in repository for avalible merchandises…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the hat’s words in a dictionary. InputStandard…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 Problem Descriptionlily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数.下面你的任务是帮助xiaoou333解决这个问题. Input有多组数据,每组一行,每组就是一篇小文章.每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束. Output每组只输出一个整数,其单独成行,该整数代表一篇文章里不同单词…
Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers: Emergency 911 Alice 97 625 999 Bob 91 12 54 26 In this case, it's not possible to c…
题意: 百度. 思路: 一个串的插入只能搞出这个串的前缀,然而对于要query的串是子串,所以插入的时候暴力插入所有字母开头的串.... 然后还要注意到自己的串本身会叠加字典树中的前缀,要标记掉. #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int,int> PII; const int N=2e6+10; int g[N][27],sz,num[N],id[N];…
RepositoryTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 7233 Accepted Submission(s): 2278 Problem DescriptionWhen you go shopping, you can search in repository for avalible merchandises by…