
hash
文章平均质量分 66
HelloWorld10086
追随大神的脚步
展开
-
UVA - 188 Perfect Hash(hash)
Perfect Hash Perfect Software, Inc. has obtained a government contract to examine text flowing through a high-speed network for the occurrence of certain words. Your boss, Wally Perfect,原创 2014-08-29 11:04:43 · 921 阅读 · 0 评论 -
UVA - 10282 Babelfish(map应用)
Problem C: Babelfish You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you underst原创 2014-08-29 19:50:39 · 899 阅读 · 0 评论 -
UVA - 10887 Concatenation of Languages(hash)
Problem A Concatenation of Languages Input File: Standard Input Output: Standard Output A language is a set of strings. And the concatenation of two languages is the set of all strings that are原创 2014-08-31 19:15:16 · 847 阅读 · 0 评论 -
UVA - 10125 Sumsets(二分查找)
Problem C - Sumsets Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S. Input Several S, each consisting of a line containing an原创 2014-08-31 19:10:00 · 911 阅读 · 0 评论 -
UVA - 141 The Spot Game(hash)
The Spot Game The game of Spot is played on an NxN board as shown below for N = 4. During the game, alternate players may either place a black counter (spot) in an empty square or remove原创 2014-09-01 20:35:43 · 914 阅读 · 0 评论 -
UVA - 10591 Happy Number(hash)
Problem C Happy Number Time Limit 1 Second Let the sum of the square of the digits of a positive integer S0 be represented by S1. In a similar way, let the sum of the sq原创 2014-09-02 13:06:27 · 834 阅读 · 0 评论 -
UVA - 10391 Compound Words(hash)
Problem E: Compound Words You are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is the concatenation of exactly two other words原创 2014-08-29 20:43:29 · 1378 阅读 · 0 评论 -
hdu 5183-Negative and Positive (NP) (hash+输入外挂)
题意: 给定一个序列a[0],a[1]….a[n-1]和一个整数k,问是否有这样的两个下标使得 NP-Sum(i,j)=k,这里 NP-Sum(i,j)=a[i]-a[i+1]+a[i+2]-…+(-1)^(j-1)*a[j]。 解析: 首先题目提示说要用快速输入,如果不用快速输入可能会超时。 现在来讨论一下这题的做法: 我们可以维护这个序列的后缀和,然后枚举sum[i]查看原创 2015-03-15 18:58:56 · 704 阅读 · 0 评论 -
Codeforces 558B Amr and The Large Array(hash)
题意: 给一个数组,记数组中出现次数最多的元素出现的次数为这个数组的美丽值,求这个数组长度最短的子数组(要连续),使得该子数组的美丽值与原数组美丽值相等。要求输出子数组的起始和结束位置下标(从1开始)。 解析: 也是个水题。每个数最大才10610^6,用hash存储每个数出现的次数即可。输入的时候用一个结构体记录最左边的位置,和最右边的位置,以及区间的长度和每个值出现的次数,再把hash存入原创 2015-07-15 16:21:26 · 604 阅读 · 0 评论