题意:有十种珠宝用数字表示,现在给你每个珠宝的数量,问可不可以平均分给两个人。解题思路: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
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-21 17:27:55
阅读次数:
252
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 a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
Note:
All numbers (including target) will be ...
分类:
其他好文 时间:
2014-05-21 15:55:25
阅读次数:
259
题目:
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