摘要: Max SumTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 82954Accepted Submission(s): 19109Problem DescriptionGiven 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 阅读全文
posted @ 2012-08-04 21:23 疼痛落在指尖 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 最大连续子序列Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11729Accepted Submission(s): 4937Problem Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, 阅读全文
posted @ 2012-08-04 21:20 疼痛落在指尖 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 最大报销额Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10568Accepted Submission(s): 2841Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input测试输入包含若 阅读全文
posted @ 2012-08-04 21:09 疼痛落在指尖 阅读(120) 评论(0) 推荐(0) 编辑
摘要: RobberiesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4531Accepted Submission(s): 1713Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because the 阅读全文
posted @ 2012-08-04 21:05 疼痛落在指尖 阅读(209) 评论(0) 推荐(0) 编辑
摘要: //背包问题:f[v]=max(f[v],f[v-cost]+weight)#include<iostream>#define max(a,b) a>b?a:busing namespace std;int c[300000],i,k,sum,a[110],b[110],n;//01背包void bag(int cost,int weight){for(i=sum/2;i>=cost;i--)c[i]=max(c[i],c[i-cost]+weight);}//完全背包void complete(int cost,int weight){for(i=cost;i< 阅读全文
posted @ 2012-07-27 15:44 疼痛落在指尖 阅读(159) 评论(0) 推荐(0) 编辑
摘要: /*求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。2 312 66789 100000 089841*///思路:当幂集超过6位之后对1000求余值不变。#include<iostream>using namespace std;int main(){int a,b;while(cin>>a>>b){if(a== 阅读全文
posted @ 2012-07-27 08:47 疼痛落在指尖 阅读(183) 评论(0) 推荐(0) 编辑