码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
笔试算法题(12):整数的string到int转换 & 两个栈实现队列
出题:将输入的表示整数的字符串转变为对应的整数值;分析:每当右边增加一位,说明之前的sum应该高一个数量级,所以*10。由于这两个实现仅仅考虑正规的、正整数输入,所以需要一个Wrapper函数,其功能 主要处理:符号判断(第一个字符是-,+或者直接是数字);非法输入判断(是否有非"012345678...
分类:其他好文   时间:2014-05-22 04:48:02    阅读次数:268
Linus Torvalds 指针
《对话LinusTorvalds:大多黑客甚至连指针都未理解》http://www.csdn.net/article/2013-01-10/2813559-two-star-programming“不懂指针”的开发者代码示例: 1 typedef struct node 2 { 3 ...
分类:其他好文   时间:2014-05-22 04:40:17    阅读次数:245
8.另类方法求1+2+...+n
Another way to calculate sum of 1 to N.
分类:其他好文   时间:2014-05-22 03:33:00    阅读次数:201
nyoj--Divideing Jewels
题意:有十种珠宝用数字表示,现在给你每个珠宝的数量,问可不可以平均分给两个人。解题思路:DFS搜索可以写。将完全背包问题转换为搜索问题。具体代码:#include#include#includeusing namespace std;int num[15],sum;bool dfs(int n,in...
分类:其他好文   时间:2014-05-22 03:26:34    阅读次数:206
10.排序数组中和为给定值的两个数字
Find 2 numbers with given sum in sorted array.
分类:其他好文   时间:2014-05-22 01:53:17    阅读次数:288
26.打印所有和为S的连续正整数序列
Find continuous sequences between 1 to N whose sum equals to S.
分类:其他好文   时间:2014-05-21 23:59:57    阅读次数:394
一段小程序理解getchar和putchar
#include "stdafx.h"#include using namespace std;int main(){ char c,d,e,f; printf("please input two characters:\n"); c=getchar(); putchar...
分类:其他好文   时间:2014-05-21 23:46:19    阅读次数:352
sql基础复习
--1、while循环declare @sum intdeclare @i intset @i=1set @sum=0while(@i90) print @iendprint @sum--2、goto语句declare @num intset @num=100flag:print @numsel.....
分类:数据库   时间:2014-05-21 22:20:40    阅读次数:468
leetcode -day20 Add Two Numbers
1、 ?? 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 num...
分类:其他好文   时间:2014-05-21 10:49:10    阅读次数:221
读入a,b当a,b不同时为零时结束
#define LOCAL#include#includeconst int MAX_N=100;int a[MAX_N],b[MAX_N];void init(){ for(int i=0;i=1) { if(b[sum-1]<10) printf(...
分类:其他好文   时间:2014-05-21 04:53:29    阅读次数:175
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!