码迷,mamicode.com
首页 >  
搜索关键字:k sum    ( 21381个结果
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
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
20140710 sequence
考试的时候想了好久都没想出正解 >_ 2 #include 3 #include 4 using namespace std; 5 #define N 500500 6 typedef long long LL; 7 8 int n,k; 9 int num[N];10 int sum[N];...
分类:其他好文   时间:2014-07-13 08:20:23    阅读次数:207
【leetcode】Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:其他好文   时间:2014-07-13 08:13:53    阅读次数:251
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
迷上了代码!