刷题
文章平均质量分 54
Christine1024
这个作者很懒,什么都没留下…
展开
-
LeetCode 1.Two Sum
LeetCode 1.Two Sum题目描述Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution.Example:原创 2016-09-14 16:52:07 · 430 阅读 · 0 评论 -
LeetCode 15. 3sum
题意描述 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not c原创 2016-09-16 10:46:35 · 395 阅读 · 0 评论 -
LeetCode 46. Permutations
题意描述 Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3]原创 2016-09-25 16:15:17 · 358 阅读 · 0 评论 -
LeetCode 31. Next Permutation
题目描述 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest原创 2016-09-25 20:44:55 · 460 阅读 · 0 评论 -
LeetCode 357. Count Numbers with Unique Digits
题目描述: Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤原创 2016-10-31 22:07:41 · 435 阅读 · 0 评论 -
hdu 3687 National Day Parade
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3682 题目大意: 有一个n*m的格子(n 水题,暴力解决~~ 贴代码: #include #include #include #include #include using namespace std; #define inf 0x3f3f3f3f struct n原创 2013-10-16 19:15:58 · 3489 阅读 · 0 评论 -
HDU 4666 经典的求最远曼哈顿距离
求最远曼哈顿距离,对于一个n维的空间,其中两点的曼哈顿距离为:|x1-y1|+|x2-y2|+|x3-y3|+|x4-y4|+……+|xn-yn| (两点的坐标分别为(x1,x2,……,xn)、(y1,y2,……,yn)) 以下以二维平面为例研究: 设距离最远的两点为i,j,可知所求的最大距离必定有以下四种形式之一: (xi-xj)+(yi-yj), (原创 2013-08-14 11:01:01 · 1155 阅读 · 0 评论 -
HDU 4662 MU Puzzle
#include #include #include #include #include using namespace std; const int maxn = 1000007; char str[maxn]; long long a[40]; void init() { // int k=1; a[0]=1; for(int i=1; i<=32; i原创 2013-08-08 18:48:49 · 1101 阅读 · 0 评论 -
Kickstart Round B 2017——Problem B. Center(及一点延伸)
题目介绍 题目链接: https://codejam.withgoogle.com/codejam/contest/11304486/dashboard#s=p1 题目大意:二维平面上有N个点,每个点的坐标为(Xi, Yi),每个点的权重为Wi,找到一个中心点(X, Y),使得max(|X-Xi|, |Y-Yi|)*Wi的和最小。N最大10000。 相关知识 先介绍一些概念性的东西(机器学习的东西原创 2017-05-10 00:05:24 · 1413 阅读 · 2 评论