acm-其他
文章平均质量分 80
maverick1990
这个作者很懒,什么都没留下…
展开
-
poj 1009 Edge Detection
分类:其他 难度:2题意:给定一张图的每行长度w,及每个点的像素值,以(像素值,持续长度)对表示,求每个像素和周围8个点的差值绝对值的最大值,结果依然以(像素值,持续长度)表示,点数[2,1e9],给定(像素值,持续长度)对的上限为1000对 通过点数的范围可知,这道题不能用O(n)算法遍历,超时;也不能把每个像素点单个存储,超内存。开始考虑对于一个持续长度为len的像素,可知若len原创 2013-04-07 21:18:53 · 1301 阅读 · 0 评论 -
Google中国2015校园招聘笔试Round D APAC Test Problem D. Itz Chess
ProblemGiven an arranged chess board with pieces, figure out the total number of different ways in which any piece can be killed in one move. Note: in this problem, the pieces can be killed despite原创 2014-11-14 14:50:40 · 1207 阅读 · 0 评论 -
leetcode-Container With Most Water
Container With Most Water Total Accepted: 11787 Total Submissions: 38592My SubmissionsGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai)原创 2014-07-05 23:33:29 · 772 阅读 · 0 评论 -
leetcode-3Sum Closest
转自:http://www.cnblogs.com/remlostime/archive/2012/10/27/2742667.htmlGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return th转载 2014-03-24 22:59:17 · 1066 阅读 · 0 评论 -
leetcode-LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if原创 2014-04-16 13:41:27 · 747 阅读 · 0 评论 -
wikioi-天梯-提高一等-哈希表-2144:砝码称重2
题目描述 Description有n个砝码,现在要称一个质量为m的物体,请问最少需要挑出几个砝码来称?注意一个砝码最多只能挑一次输入描述 Input Description第一行两个整数n和m,接下来n行每行一个整数表示每个砝码的重量。输出描述 Output Description输出选择的砝码的总数k,你的程原创 2014-02-18 22:08:33 · 1325 阅读 · 0 评论 -
TopCoder SRM 598 Div1 第1题
Problem Statement Fox Ciel has some items. The weight of the i-th (0-based) item is item[i]. She wants to put all items into bins.The capacity of each bin is 300. She can put an a原创 2013-12-02 20:20:27 · 983 阅读 · 0 评论 -
Google中国2014校园招聘笔试Round B China New Grad Test Problem B. Meet and party
ProblemLittle Sin lives in a Manhattan-grid city, a 2D plane where people can only go north, west, south or east along the grid. The distance from (x1, y1) to (x2, y2) is |x1 - x2| + |y1 - y2|.L原创 2013-10-16 12:39:54 · 2283 阅读 · 0 评论 -
Google中国2014校园招聘笔试Round A China New Grad Test Problem A. Read Phone Number
ProblemDo you know how to read the phone numbers in English? Now let me tell you.For example, In China, the phone numbers are 11 digits, like: 15012233444. Someone divides the numbers into 3-4-4 f原创 2013-09-25 12:37:06 · 2675 阅读 · 0 评论 -
poj 2419 Forests
分类:其他 难度:1 题意:给出p,t两个数,p个人,t棵树,给出一堆i,j两个数的集合,表示第i个人听到第j棵树倒下。听到倒下的树的集合完全相同的人为一组,问有几组人 分析:解法一:简单思路,给一个矩阵re[100][100],re[i][j]存储第i个人听到第j棵树倒下,然后遍历每两个人,比较是否相同,时间复杂度O(p^2 * t),空间复杂度O(p*t)解法二:考虑每原创 2013-08-26 19:09:51 · 1445 阅读 · 0 评论 -
Google Code jam 2013 Round 1B A题
分类:其他 难度:2 ProblemArmin is playing Osmos, a physics-based puzzle game developed by Hemisphere Games. In this game, he plays a "mote", moving around and absorbing smaller motes.A "mote" in Englis原创 2013-05-05 23:56:34 · 1145 阅读 · 0 评论 -
poj 1142 Smith Numbers
分类:其他 难度:1.5 题意:将一个数各个位的和,与因式分解的每个因数各个位的和,如相等,为smith数,4937775= 3*5*5*65837,4+9+3+7+7+7+5= 42, 3+5+5+6+5+8+3+7=42。求大于给出的n的最小smith数。因式分解,map记录因式分解结果,map[因数]=出现次数。#include#includeusing namespac原创 2013-04-10 19:33:35 · 839 阅读 · 0 评论 -
Google中国2015校园招聘笔试Round D APAC Test Problem C. Sort a scrambled itinerary
ProblemOnce upon a day, Mary bought a one-way ticket from somewhere to somewhere with some flight transfers.For example: SFO->DFW DFW->JFK JFK->MIA MIA->ORD.Obviously, transfer flights at a原创 2014-11-14 11:44:02 · 1519 阅读 · 0 评论