码迷,mamicode.com
首页 >  
搜索关键字:a2    ( 4261个结果
HDU 3988 Harry Potter and the Hide Story(数论-整数和素数)
题目大意: 给定n和k, 求 n! 能被 k^i 整除时,i 的最大取值。 解题思路: 将k分解质因素,问题变为,(1×2×3×...×n) 要被 ( p1^(i*a1) × p2^(i*a2) × ... × pn^(i*an) ) 整除,即分子中各分母的质因数的幂次要大于等于分母。 所以根据k的各质因素,求出满足各质因数的幂次 分子>=分母 的关系限制i,算出最大的i即可。 这题要用到unsigned long long,比较坑。。...
分类:其他好文   时间:2014-08-03 18:08:25    阅读次数:299
最大子序列问题
最大子数组问题定义 给定整数A1, A2, …, An(其中可能是负数),求k的最大值和序列的起始位置(为了方便起见,如果所有整数均为负数,则最大子序列和为0),使用四种算法(根据运行时间区分)解决这个问题。运行时间为θ(n3) 使用了三个for循环,在最坏情况下,运行时间为θ(n3)C语言实现代码...
分类:其他好文   时间:2014-08-03 17:59:35    阅读次数:263
【POJ】3468 A Simple Problem with Integers ——线段树 成段更新 懒惰标记
A Simple Problem with IntegersTime Limit:5000MS Memory Limit:131072KCase Time Limit:2000MSDescriptionYou haveNintegers,A1,A2, ... ,AN. You need to d.....
分类:其他好文   时间:2014-08-03 17:59:25    阅读次数:213
hdu acm 2844 Coins 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2844题目意思:有A1,A2,...,An 这 n 种面值的钱,分别对应的数量是C1,C2,...,Cn。问根据这么多数量的钱 能组成多少个 2 #include 3 #include 4 usin...
分类:其他好文   时间:2014-08-03 15:06:15    阅读次数:213
POJ - 3468 A Simple Problem with Integers (区间求和)
Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other ...
分类:其他好文   时间:2014-08-03 12:53:25    阅读次数:311
poj 1456 Supermarket (贪心+并查集)
# include # include # include using namespace std; int fa[10010]; struct node { int p; int d; }; struct node a[10010]; bool cmp(node a1,node a2)//利润从大到小 { return a1.p>a2.p; } int find(int x) {...
分类:其他好文   时间:2014-08-03 10:16:25    阅读次数:208
POJ 2356 Find a multiple 鸽巢原理
题目来源:POJ 2356 Find a multiple 题意:n个数 选出任意个数 使得这些数的和是n的倍数 思路:肯定有解 并且解是连续的一段数 证明: 假设有m个数 a1,a2,a3...am    s1 s2 s3...sm为前缀和 s1 = a1 s2 = a1+a2 s3 = a1+a2+a3... sm = a1+a2+a3+...+am 1.如果某个前缀和si%m =...
分类:其他好文   时间:2014-08-02 21:01:54    阅读次数:312
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!