码迷,mamicode.com
首页 >  
搜索关键字:k sum    ( 21381个结果
uva 10791 Minimum Sum LCM ( 唯一分解定理 )
使用唯一分解定理的时候不一定要打出素数表,这句话是相对上一篇来讲的。做这道题目之前我对唯一分解定理方法的理解不完全。 现在多想到了一些 唯一分解,将当前需要分解的n用因子将其分解表达。需要试因子。 因子的枚举应该是从2开始(从1开始没有意义),当当前数字n可以整除当前因子i时,就使其不断除以i,直到不能整除。 这个步骤实际上已经在根本上避免了出现像4、6这种因子在唯一分解式中的出现——之前...
分类:其他好文   时间:2014-08-12 13:49:44    阅读次数:222
题目552-小数阶乘-nyoj20140811
#include int main(){ int m; while(scanf("%d",&m)!=EOF) { int sum,i; sum=1; for(i=1;i<=m;i++) sum=sum*i; printf("%d\n",sum); } return 0; }
分类:其他好文   时间:2014-08-12 00:08:43    阅读次数:217
[LeetCode] 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers....
分类:其他好文   时间:2014-08-12 00:03:33    阅读次数:269
[LeetCode] 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of ...
分类:其他好文   时间:2014-08-11 23:52:23    阅读次数:209
题目550-三位数逆序输出-nyoj20140811
#include int main(){ int m; while(scanf("%d",&m)!=EOF) { int a1,a2,a3,sum,n; a1=m%10; n=(m-a1)/10; a2=n%10; a3=m/100; sum=100*a1+a2*10+a3; printf("%d\...
分类:其他好文   时间:2014-08-11 23:45:43    阅读次数:249
POJ训练计划2828_Buy Tickets(线段树/单点更新)
解题报告 题意: 插队完的顺序。 思路: 倒着处理数据,第i个人占据第j=pos[i]+1个的空位。 线段树维护区间空位信息。 #include #include #include using namespace std; struct node { int x,v; } num[201000]; int sum[1000000],ans[201000]; void c...
分类:其他好文   时间:2014-08-11 21:34:33    阅读次数:378
遇到的错误java.lang.ClassCastException
package tpackage; public class ArrayList { private Object list[]; private int sum=0; public ArrayList(){ this(16); } public ArrayList(int capacity) { list = new Object[capacity]; } p...
分类:编程语言   时间:2014-08-11 21:32:32    阅读次数:289
[leetcode]Binary Tree Maximum Path Sum
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be...
分类:其他好文   时间:2014-08-11 21:13:02    阅读次数:219
56.一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
#includeusing namespace std;int main(){ float sum=0;//注意声明成浮点型 float n=100.0; for(int i=1;i<=10;i++) { sum+=n; n=n*0.5; }...
分类:其他好文   时间:2014-08-11 20:26:52    阅读次数:294
HDU 4825 Xor Sum(二进制的字典树,数组模拟)
题目//居然可以用字典树。。。//用cin,cout等输入输出会超时//这是从别处复制来的#include#include#includeusing namespace std;int node[3011111][2];int tag,m,n,cas=0,T;long long one[64],al...
分类:其他好文   时间:2014-08-11 17:34:52    阅读次数:286
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!