码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
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 nu...
分类:其他好文   时间:2014-05-01 08:35:40    阅读次数:443
[leetcode] Minimum Path Sum
思路很简单,就是存储之前运算的结果,然后递归class Solution {public: int** dp; int get_min_sum(vector > &grid, int m, int n) { if (dp[m][n] != -1) ...
分类:其他好文   时间:2014-05-01 07:54:47    阅读次数:330
Codeforces Round #243 (Div. 1)——Sereja and Two Sequences
给两个长度分别为n和m的序列,现在有两种操作:1.分别选择两个序列的一个非空前缀,切两个前缀的最后一位相同,删除之,得到1分(只累计),消耗e;2.直接删除两个序列,消耗值定于两个序列之前删除的元素个数之和,并且使得得到的分有效(之前没有有效分) (1?≤?n,?m?≤?105; 1?≤?s?≤?3·105; 103?≤?e?≤?104),s代表总能量,e表示一次操作的消耗...
分类:其他好文   时间:2014-04-30 22:13:40    阅读次数:261
Timus 1642. 1D Maze迷宫
1D people lived in a 1D country. Everything in the country was one-dimensional, and everything was simple and clear: just one axis and two directions — forward and backward. Even a 1D world has proble...
分类:其他好文   时间:2014-04-29 13:44:22    阅读次数:284
Pat(Advanced Level)Practice--1063(Set Similarity)
Pat1063代码 题目描述: Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the to...
分类:其他好文   时间:2014-04-29 13:44:20    阅读次数:325
c语言参数传递方式
今天在写栈碰到 了一个问题关于c语言参数传递的让我郁闷了半天 我只发现了两个问题一个 实参sum(a,b) 形参sum(int a,int b)或者sum(int &a,int &b) 实参sum(&a,&b) 形参sum(int *a,int *b) 这个就是c函数传地址与传引用传值!...
分类:编程语言   时间:2014-04-29 13:38:21    阅读次数:271
NYOJ 215 Sum
NYOJ 215 Sum...
分类:其他好文   时间:2014-04-29 13:25:20    阅读次数:192
Leetcode:Container with most water 最大蓄水量
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin...
分类:其他好文   时间:2014-04-29 13:15:21    阅读次数:415
数组求和的快速方法(利用cuda的共享内存)--第一部分之源码分析
代码来自于这里 https://code.google.com/p/stanford-cs193g-sp2010/source/browse/trunk/tutorials/sum_reduction.cu...
分类:其他好文   时间:2014-04-29 13:13:20    阅读次数:324
Leetcode:Add Binary 二进制相加
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 思路同十进制的大数相加。代码如下: class Solution { public: string addBinary(string a, str...
分类:其他好文   时间:2014-04-29 13:12:20    阅读次数:328
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!