码迷,mamicode.com
首页 >  
搜索关键字:combination sum ii    ( 27716个结果
codeforce447 D SGU 548 贪心+优先队列
codeforce447 D - DZY Loves Modification题意:有一个n*m的矩阵,每次可以选择一行或者一列,可以得到这行或这列的所有元素sum的积分,然后使这一列/行的每一个元素都减少p,接着再选择一行或一列,共操作k次,n,m10 #include 11 #include 1...
分类:其他好文   时间:2014-07-23 15:36:59    阅读次数:264
poj 3370 Halloween treats
不懂得详见poj  2356  抽屉原理详解,这题竟然卡精度。。。提交了好几次都WA,改成long long sum[100100] 才对 代码如下: #include #include int flag[100100],a[100100],str[100100]; long long sum[100100]; int main() { int n,i,j,t,chi; whi...
分类:其他好文   时间:2014-07-23 13:38:16    阅读次数:228
hdoj 4864 Task 【贪心】
贪心策略:因为2*难度(1~100) 远比500*时间 的影响小,所以说,先对时间从大到小排序,相等的再按照等级从大到小排序;对任务和机器都排序之后,再统计满足任务时间的机器,选择等级最接近任务难度的的机器; 因为数据很多,很可能超出int范围,要用长整型,但是最后输出的时候,如果用printf( "%lld %lld\n", sol, sum );输出的话,会发现第二个数会是0,在这上面wa了n次。。 最后问了一下学长,用了%I64,才正确,后来有自己百度了一下http://blog.csdn.net...
分类:其他好文   时间:2014-07-23 13:25:18    阅读次数:297
hdu 1864最大报销额 (01背包模板)
//注意将价格转化为整数即可 # include # include # include using namespace std; int max(int a,int b) { return a>b?a:b; } int dp[3000050]; int main() { int n,i,j,flag,l,m; int suma,sumb,sumc,sum; double q,...
分类:其他好文   时间:2014-07-23 13:15:36    阅读次数:177
Linked List Cycle leetcode II java (寻找链表环的入口)
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra spac....
分类:编程语言   时间:2014-07-23 12:02:46    阅读次数:304
Linked List Cycle leetcode java (链表检测环)
题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题解:这道题连带着II是很经典的,在看CC150时候,纠结这个问题纠结了很久....
分类:编程语言   时间:2014-07-23 12:02:26    阅读次数:311
Remove Duplicates from Sorted List II leetcode java
题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1....
分类:编程语言   时间:2014-07-23 12:01:46    阅读次数:312
【LeetCode】Single Number II
题目 Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it wit...
分类:其他好文   时间:2014-07-23 00:13:17    阅读次数:331
out与ref修饰符
out修饰符定义作用使用注意总结定义out意为output,所以被out修饰的参数叫做输出参数.通过使用out修饰的参数,方法可以返回对应参数的值作用先看一个例子定义变量:1 int x=1,y=2,sum;//定义x,y,sum三个整型变量定义方法:1 static void Add(int x,...
分类:其他好文   时间:2014-07-22 23:41:17    阅读次数:412
4 Values whose Sum is 0
Time Limit:15000MSMemory Limit:228000KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionThe SUM problem can be formulated as follows: given four li...
分类:其他好文   时间:2014-07-22 22:48:32    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!