码迷,mamicode.com
首页 >  
搜索关键字:combination sum ii    ( 27716个结果
poj 1528 Perfection
题目链接:http://poj.org/problem?id=1528题目大意:输入一个数n,然后求出约数的和sum,在与这一个数n进行比较,如果sum>n,则输出ABUNDANT,如果sum=n,则输出PERFECT,否则,输出DEFICIENT!注意1的结果是DEFICIENT,0的结果是END...
分类:其他好文   时间:2014-07-14 08:59:30    阅读次数:167
概率法求解三阶幻方[C语言]
#include #include int in[9]={1,2,3,4,5,6,7,8,9};int s[9];int re[3][3];int sum(int su[]){ int i,re=0; for(i=0;su[i];i++) re+=su[i]; ret...
分类:编程语言   时间:2014-07-13 22:08:59    阅读次数:342
省赛i题/求1~n内所有数对(x,y),满足最大公约数是质数的对数
求1~n内所有数对(x,y),gcd(x,y)=质数,的对数。 思路:用f[n]求出,含n的对数,最后用sum【n】求和。 对于gcd(x,y)=a(设x 他们乘积的f[i*a]值包括i的欧拉函数值。时间复杂度(n*质数个数) #include #include using namespace std; const int maxx=100010; int mindiv[maxx+5],p...
分类:其他好文   时间:2014-07-13 16:45:50    阅读次数:177
HDU1003 Max Sum(求最大字段和)
HDU1003 Max Sum(求最大字段和)...
分类:其他好文   时间:2014-07-13 15:33:13    阅读次数:180
Path Sum
Given 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 given sum. For example: Given the below binary tree and sum ...
分类:其他好文   时间:2014-07-13 13:58:01    阅读次数:184
ACdream 1139(Sum-逆元)
J - Sum Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitStatus Problem Description You are given an N*N digit matrix and you can get several horizont...
分类:其他好文   时间:2014-07-12 20:26:54    阅读次数:269
Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". public class Solution { public String addBinary(String a, String b) { ...
分类:其他好文   时间:2014-07-12 19:42:26    阅读次数:168
HDU 1016 Prime Ring Problem 题解
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime...
分类:其他好文   时间:2014-07-12 16:42:15    阅读次数:271
hdu 2492 Ping pong 线段树
给定一个序列,求出一共有多少个三元组(ai,aj,ak),使得i#include #define maxn 100200#define N 20100int sum[maxn*4];int lmax[N],lmin[N],rmax[N],rmin[N];int ans[N];void pushup(...
分类:其他好文   时间:2014-07-12 14:39:08    阅读次数:174
hdu 1059 Dividing 多重背包
就是看能不能装满给定容量的背包。#include #include int dp[200000],a[15];int main(){ int cas=0,c; int i,j,k; while(1) { int sum=0; cas++; ...
分类:其他好文   时间:2014-07-12 14:35:59    阅读次数:188
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!