码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
Summation of primes
是我算法不对,还是笔记本CPU太差?我优化了两次,还是花了三四个小时来得到结果。在输出上加1就是最终结果。The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two mil...
分类:其他好文   时间:2014-05-09 16:20:08    阅读次数:295
Leetcode | Path Sum I && II
Path Sum IGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the gi...
分类:其他好文   时间:2014-05-09 13:21:59    阅读次数:320
hust 1009 Sum the K-th
题目描述N integers are arranged on a circle clockwise. Given two integers M and K. For each position, you should take M continuous integers on the left an...
分类:其他好文   时间:2014-05-09 10:30:49    阅读次数:350
Leetcode | 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 ...
分类:其他好文   时间:2014-05-09 10:27:29    阅读次数:449
Bluetooth
Android provides a default Bluetooth stack, BlueDroid, that is divided into two layers: The Bluetooth Embedded System (BTE), which implements the core...
分类:其他好文   时间:2014-05-09 10:18:47    阅读次数:518
Leetcode: Merge Two Sorted Lists
一点小错,两次过,基本思想是先比较头元素,哪个小就在哪个list的基础上插入,需要考虑两种不同的结束方式 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 *...
分类:其他好文   时间:2014-05-09 09:21:59    阅读次数:273
bzoj 1010,1011
1011:#include #include #include #include #include using namespace std;const int maxN = 100001;const double eps = 1e-7;int n;double m[maxN],sum[maxN];d...
分类:其他好文   时间:2014-05-09 08:36:06    阅读次数:303
LeetCode OJ - Gray Code
这道题就是找规律啊!!!想想啊,11和10是可以连续的,那么10和11也是可以连续的。下面是AC代码: 1 /** 2 * The gray code is a binary numeral system where two successive values differ in on...
分类:其他好文   时间:2014-05-09 07:38:17    阅读次数:325
杭电oj 1001
#includeusing namespace std;int main(){ int n = 0, sum; while (cin>>n) { sum = 0; // 这里要清零 for (int i =0; i <= n; i++) {...
分类:其他好文   时间:2014-05-09 05:38:17    阅读次数:241
c的基础 1. 无符号数和补码
计算机系统中有三种重要的数字表示,无符号(unsigned)编码,只能表示非负的数,补码(two's-complement)编码,用来表示有符号整数。...
分类:其他好文   时间:2014-05-09 00:26:42    阅读次数:384
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!