码迷,mamicode.com
首页 >  
搜索关键字:return 设置样式 获取样式    ( 61336个结果
【leetcode】Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-05-21 20:00:51    阅读次数:296
php利用新浪接口查询ip获取地理位置示例
desc)) { $loc = $location->province.$location->city.$location->district.$location->isp; }else{ $loc = $location->desc; } return $loc;}ec...
分类:Web程序   时间:2014-05-21 19:41:19    阅读次数:364
LeetCode: First Missing Positive [040]
【题目】 Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant space. 【题意】 给定一个数组,找出第一个缺失的正数。时间复杂度O(n) ...
分类:其他好文   时间:2014-05-21 17:13:07    阅读次数:219
13周 项目1 点,圆的关系
#include #include using namespace std; class Point { public: Point(double a,double b):x(a),y(b) {} double getx() { return x; } double gety() { ...
分类:其他好文   时间:2014-05-21 14:44:07    阅读次数:281
13周 项目2 圆的比较
#include #include using namespace std; class Point { public: Point(double a,double b):x(a),y(b) {} double getx() { return x; } double gety() { return y; ...
分类:其他好文   时间:2014-05-21 10:09:26    阅读次数:309
多重背包模板
/** * 多重背包: * 有N种物品和一个容量为V的背包。第i种物品最多有Mi件可用, * 每件耗费的空间是Ci,价值是Wi。 * 求解将哪些物品装入背包可使这些物品的耗费的空间总和不超过背包容量,且价值总和最大。 */ #include #include int max(int a, int b){ if (a > b)return...
分类:其他好文   时间:2014-05-21 10:00:56    阅读次数:206
LeetCode:Two Sum
题目:       Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up t...
分类:其他好文   时间:2014-05-21 07:42:18    阅读次数:230
Leetcode:Reverse Linked List II 单链表区间范围内逆置
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the fol...
分类:其他好文   时间:2014-05-21 07:18:02    阅读次数:301
HRBUST 1328 相等的最小公倍数
SOl:将原题改为枚举N的每一对因子,计算其是否互素即可。 #include #include #include using namespace std; inline int gcd(int a,int b) { return b==0?a:gcd(b,a%b); } int main() { int n,T,i,j; scanf("%d",&T); while(T...
分类:其他好文   时间:2014-05-21 07:07:00    阅读次数:273
LeetCode: Trapping Rain Water [041]
【题目】 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. The above elevation map is represente...
分类:移动开发   时间:2014-05-21 06:44:38    阅读次数:359
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!