小G的ACM之路

一个在艰难爬坑的菜鸟

Codeforces 558B Amr and The Large Array(hash)

题意: 给一个数组,记数组中出现次数最多的元素出现的次数为这个数组的美丽值,求这个数组长度最短的子数组(要连续),使得该子数组的美丽值与原数组美丽值相等。要求输出子数组的起始和结束位置下标(从1开始)。 解析: 也是个水题。每个数最大才10610^6,用hash存储每个数出现的次数即可。输...

2015-07-15 16:21:26

阅读数 408

评论数 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]。 解析: 首先题目提示说要用快速输入,如果不用快速输入可能会超...

2015-03-15 18:58:56

阅读数 482

评论数 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 represe...

2014-09-02 13:06:27

阅读数 554

评论数 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 ...

2014-09-01 20:35:43

阅读数 628

评论数 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 ...

2014-08-31 19:15:16

阅读数 567

评论数 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 ...

2014-08-31 19:10:00

阅读数 638

评论数 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 th...

2014-08-29 20:43:29

阅读数 914

评论数 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. Fortu...

2014-08-29 19:50:39

阅读数 574

评论数 0

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 occ...

2014-08-29 11:04:43

阅读数 644

评论数 0

提示
确定要删除当前文章?
取消 删除
关闭
关闭