Another way to calculate sum of 1 to N.
分类:
其他好文 时间:
2014-05-22 03:33:00
阅读次数:
201
题意:有十种珠宝用数字表示,现在给你每个珠宝的数量,问可不可以平均分给两个人。解题思路:DFS搜索可以写。将完全背包问题转换为搜索问题。具体代码:#include#include#includeusing
namespace std;int num[15],sum;bool dfs(int n,in...
分类:
其他好文 时间:
2014-05-22 03:26:34
阅读次数:
206
Find 2 numbers with given sum in sorted array.
分类:
其他好文 时间:
2014-05-22 01:53:17
阅读次数:
288
Find continuous sequences between 1 to N whose sum
equals to S.
分类:
其他好文 时间:
2014-05-21 23:59:57
阅读次数:
394
--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
题目链接已知 gcd(x, y, z) = G, lcm(x, y, z) = L,
求有多少种组合(x, y, z)可以满足条件。G, L都在32位int范围内。思路: 素数分解 + 容斥L : p1^t1 * p2^t2 ... *
pi^tiG: q1^s1 * q2^s2... * qi^s...
分类:
其他好文 时间:
2014-05-21 17:57:31
阅读次数:
266
Xor Sum
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)
Total Submission(s): 7837 Accepted Submission(s): 3350
Problem Description
Zeus 和 Prometheu...
分类:
其他好文 时间:
2014-05-21 17:02:00
阅读次数:
160
题目:
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
大数相加
[cpp] view
plaincopy
#include
#include
char a[10001],b[10001],sum[10002];
int BigIntegerAdd(){
//两个数的长度
int lena = strlen(a);
int l...
分类:
其他好文 时间:
2014-05-21 06:32:32
阅读次数:
361
#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