码迷,mamicode.com
首页 >  
搜索关键字:combination sum ii    ( 27716个结果
循环-01. 求整数段和(15)
1 #include 2 #include 3 using namespace std; 4 int main(){ 5 int m,n,c=0,sum=0; 6 cin>>m>>n; 7 while(m<=n){ 8 if(c&&c%5==0) 9 ...
分类:其他好文   时间:2014-07-07 12:35:43    阅读次数:253
循环-05. 兔子繁衍问题(15)
1 #include 2 using namespace std; 3 int sum(int n){ 4 if(n==1||n==2) 5 return 1; 6 else 7 return sum(n-1)+sum(n-2); 8 } 9 int...
分类:其他好文   时间:2014-07-07 10:45:18    阅读次数:188
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-02 21:13:05    阅读次数:170
poj1089:Intervals
1089:Intervals总时间限制: 1000ms 内存限制: 65536kB描述There is given the series of n closed intervals [ai; b i], where i=1,2,...,n. The sum of those intervals ma...
分类:其他好文   时间:2014-07-02 20:39:31    阅读次数:236
silverlight visifire控件图表制作——silverlight 后台方法ControlChart.xaml.cs
一、构造方法ControlChart1、前台页面控件赋值//时间下拉框赋值,下拉框赋选定值 for (int ii = DateTime.Today.Year; ii >= 1980; ii--) { string item = string.Format("{0}年", ii.ToString()...
分类:Web程序   时间:2014-07-02 19:21:55    阅读次数:180
001~003
ProjectEuler// 001 1 #include 2 3 using namespace std; 4 5 int main() 6 { 7 int sum = 0; 8 for (int i = 3; i 2 3 using namespace std; 4 ...
分类:其他好文   时间:2014-07-02 14:40:32    阅读次数:232
UVA 10883 Supermean 上下取对数防溢出
题目链接:点击打开链接 溢出了半天,觉累不爱 #include #include using namespace std; #define ll int int main(){ ll Cas= 1, T; cin>>T; while(T--){ ll n; cin>>n; double sum = 0, a; double hehe = 0; for(ll i =...
分类:其他好文   时间:2014-07-02 09:43:47    阅读次数:201
【hoj】 1017 Joseph's problem II
这个是约瑟夫的另一个变型,变为总共有2*k个人,先是K个好人后是k个坏人,要求前k次都要杀坏人,即在杀掉第一个好人之前就要把所有的坏人都杀光,所以需要我们求出满足这个条件的最小的m值;    由约瑟夫的递归模型可以发现,我们因为他的递归是从最后杀的人递归到原有的人数,所以我们可以吧顺序反过来,等价于最后杀掉k个坏人,再杀好人,这样在递归的时候就是先知道起始位置(先杀的人),这样就能迭代,由有好人...
分类:其他好文   时间:2014-07-02 08:55:40    阅读次数:188
UVA 766 - Sum of powers(伯努利数)
766 - Sum of powers 题意:求    转化成 的各系数 思路:在wiki看了伯努利数的性质,  可以推成 。 然后B为伯努利数,有公式, 如此一来就可以去递推求出每项伯努利数了,然后在根据n去通分,求出每一项的答案,中间过程用到了分数的运算。 代码: #include #include long long gcd(l...
分类:其他好文   时间:2014-07-02 08:46:49    阅读次数:339
uva 11426 - GCD - Extreme (II)(数论)
题目链接:uva 11426 - GCD - Extreme 题目大意:给出n,求∑i!=jngcd(i,j) 解题思路:f(n)=gcd(1,n)+gcd(2,n)+?+gcd(n?1,n) S(n)=f(2)+f(3)+?+f(n) S(n)=S(n?1)+f(n) 问题转化成怎么求f(n),对于一个n来说,枚举因子乘上个数即可。 #include #include ...
分类:其他好文   时间:2014-07-02 07:36:59    阅读次数:304
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!