码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
UvaLive 6661 Equal Sum Sets 二进制枚举/DP
链接:http://vjudge.net/problem/viewProblem.action?id=49406 题意:根据给出的n,k,s求出n个数每个数都不大于k,和为s的序列(n个数每个都不同)的总情况数。 思路: 1.二进制枚举枚举出所有可能排列,并求和若和为s,则符合,否则不符合。 代码: #include #include #include #include #include...
分类:其他好文   时间:2014-07-19 18:35:20    阅读次数:203
[YZOJ1579]&&[BZOJ2450]arr
Description 给出3*n个数xi,要求构造三个长度为n的序列ai,bi,ci,使得满足下列条件: 1到3*n的每个数都在三个序列中的某个出现一次且仅一次; S=sum((x[ai]-x[bi])*x[ci])最大。 输出最大的S。多组数据。Input Format 第一行...
分类:其他好文   时间:2014-07-19 14:39:18    阅读次数:214
GCD SUM 强大的数论,容斥定理
GCD SUMTime Limit:8000/4000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem Description给出N,M执行如下程序:long long ans = 0,ansx ...
分类:其他好文   时间:2014-07-19 09:15:30    阅读次数:234
线段树(自敲:建树,查找最大值,更新结点值)
HDU1754 1 #include 2 3 using namespace std; 4 5 const int MaxSIZE = 2e6 + 10; 6 7 typedef struct { 8 int Max ; 9 int left, right ...
分类:其他好文   时间:2014-07-19 09:14:48    阅读次数:250
hdu 1251 统计难题
用到tire树; 基础应用  这里讲的挺详细的 点击打开链接 #include #include #include #define max 20 using namespace std; char w[6]; struct node{ bool a; int chile[26]; int q;//前缀 node(){ q=false;...
分类:其他好文   时间:2014-07-19 08:26:00    阅读次数:181
HDU 1003 Max Sum
Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5...
分类:其他好文   时间:2014-07-19 08:25:40    阅读次数:224
poj 3974 Palindrome
边吃边敲,效率就是高 代码如下: #include #include #define MAX 1000050 char s[MAX],ss[MAX*2]; int p[MAX*2]; int min(int a,int b){return a>b?b:a;} int main() { int i,id,mx,max,n,j; j=1; while(scanf("%s",s...
分类:其他好文   时间:2014-07-19 02:31:25    阅读次数:166
hdu 3294 Girls' research
#include #include #define MAX 200020 char s[MAX],ss[MAX*2],str[2]; int p[MAX*2]; int chance(char s) { return (s- str[0] + 26) % 26 + 'a'; } int min(int a,int b){return a>b?b:a;} int main() { ...
分类:其他好文   时间:2014-07-19 02:31:05    阅读次数:201
HDU 1594 find the max
数序问题。 题意是说 一个数列 a1,a2,……ai,……an;  x=i , y = ai;找两个点斜率绝对值!!最大。 第一次没找绝对值,……认真读题。。。 x 每次加1 。 只需要找 相邻的 ai 是否是最大就好了。 #include #include #include #include #include #include #include #include #...
分类:其他好文   时间:2014-07-19 02:25:35    阅读次数:168
USACO Section 2.1 Sorting a Three-Valued Sequence
/* ID: lucien23 PROG: sort3 LANG: C++ */ #include #include #include #include using namespace std; void exchange(int nums[], int begin, int end, int N, int x); int sum = 0; int main() { ifstream ...
分类:其他好文   时间:2014-07-19 02:12:25    阅读次数:176
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!