码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
【LeetCode】Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:其他好文   时间:2014-05-23 07:43:23    阅读次数:246
2014百度之星资格赛—— Xor Sum(01字典树)
Xor Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Zeus 和 Prometheus ...
分类:其他好文   时间:2014-05-22 12:13:46    阅读次数:316
2014百度之星资格赛第三题
Xor Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 4445    Accepted Submission(s): 652 Problem Description Zeus 和 Prometheus...
分类:其他好文   时间:2014-05-22 11:02:14    阅读次数:217
UVA 11481 - Arrange the Numbers(组合数学)
题目链接:11481 - Arrange the Numbers 题意:序列1-n,进行重排,问最后前m个中有k个仍然位置不变的情况数 思路:之前写过UVA 580, n个数重排,要求每个位置都不同的情况的题目,递推式为dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2]) 利用这个,这题只要: k个位置C(m, k) * sum(C[n - m][i] (后面...
分类:其他好文   时间:2014-05-22 10:45:52    阅读次数:191
蓝桥杯 节点选择 树状动态规划
算法训练 结点选择   时间限制:1.0s   内存限制:256.0MB        锦囊1 使用树型动态规划。 锦囊2 用F[i]表示从子树i中选择结点,且结点i必须被选择的最大值,用G[i]表示从子树i中选择结点,且结点i必须不被选择的最大值。 则F[i]=a[i]+\sum(G[j]),其中a[i]表示结点i的权值,j是i的子结...
分类:其他好文   时间:2014-05-22 07:28:26    阅读次数:346
leetCode解题报告5道题(十)
5道题目分别是:【Largest Rectangle in Histogram】、【Minimum Path Sum】、【Jump Game】、【Jump Game II 】、【Valid Number】,由于有一些题目不需要发一整篇博文来记录,所以就将这些题目以一篇博文5道来记录。...
分类:其他好文   时间:2014-05-21 03:05:33    阅读次数:481
UVA 12123 - Magnetic Train Tracks(计数问题)
题目链接:12123 - Magnetic Train Tracks 题意:给定n个点,求有几个锐角三角形。 思路:和UVA 11529是同类的题,枚举一个做原点,然后剩下点根据这个原点进行极角排序,然后利用two pointer去遍历一遍,找出角度小于90度的锐角,然后扣掉这些得到钝角三角形的个数,然后在用总情况去扣掉钝角就是锐角或直角 代码: #include #include #...
分类:Web程序   时间:2014-05-20 14:10:56    阅读次数:412
Leetcode:Same Tree
戳我去解题Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identic...
分类:其他好文   时间:2014-05-20 10:09:37    阅读次数:201
百度之星2014资格赛 1003 - Xor Sum
先上代码:Xor SumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 7837Accepted Submission(s): 3350Prob...
分类:其他好文   时间:2014-05-20 09:36:48    阅读次数:271
Leetcode:Merge Two Sorted Lists
戳我去解题Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:直...
分类:其他好文   时间:2014-05-20 08:52:09    阅读次数:277
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!