2017年3月31日

Trailing Zeroes (III) 假设n!后面有x个0.现在要求的是,给定x,要求最小的n; 判断一个n!后面有多少个0,通过n/5+n/25+n/125+...

摘要: /** 题目:Trailing Zeroes (III) 链接:https://vjudge.net/contest/154246#problem/N 题意:假设n!后面有x个0.现在要求的是,给定x,要求最小的n; 思路:判断一个n!后面有多少个0,通过n/5+n/25+n/125+... */ #include #include #include #include #include us... 阅读全文

posted @ 2017-03-31 13:52 hnust_accqx 阅读(207) 评论(0) 推荐(0) 编辑

Fantasy of a Summation n个数,k层重复遍历相加。求它的和%mod的值;推导公式+快速幂

摘要: /** 题目:Fantasy of a Summation 链接:https://vjudge.net/contest/154246#problem/L 题意:n个数,k层重复遍历相加。求它的和%mod的值; 思路:很容易想到n个数出现在要加的和中的次数相同。 又所有数的出现次数为n^k * k: 所以每个数出现的次数为n^k * k / n; */ #include #include #i... 阅读全文

posted @ 2017-03-31 13:30 hnust_accqx 阅读(315) 评论(0) 推荐(0) 编辑

K - Large Division 判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余;

摘要: /** 题目:K - Large Division 链接:https://vjudge.net/contest/154246#problem/K 题意:判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余; */ #include #include #... 阅读全文

posted @ 2017-03-31 12:21 hnust_accqx 阅读(177) 评论(0) 推荐(0) 编辑

2017年3月28日

Pairs Forming LCM 在a,b中(a,b<=n)(1 ≤ n ≤ 10^14),有多少组(a,b) (a<b)满足lcm(a,b)==n; lcm(a,b)=p1 ^ max(a1,b1) * p2 ^ max(a2,b2) *..........*pn ^ max(an,bn)

摘要: 转自:http://www.cnblogs.com/shentr/p/5285407.html http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/B 全题在文末。 题意:在a,b中(a,b #include #include using namespace std; typedef long lon... 阅读全文

posted @ 2017-03-28 21:34 hnust_accqx 阅读(569) 评论(0) 推荐(0) 编辑

Harmonic Number 求Hn; Hn = 1 + 1/2 + 1/3 + ... + 1/n; (n<=1e8) T<=1e4; 精确到1e-8; 打表或者调和级数

摘要: /** 题目:Harmonic Number 链接:https://vjudge.net/contest/154246#problem/I 题意:求Hn; Hn = 1 + 1/2 + 1/3 + ... + 1/n; (n #include #include #include #include using namespace std; const int maxn = 1e4+10; cons... 阅读全文

posted @ 2017-03-28 17:17 hnust_accqx 阅读(340) 评论(0) 推荐(0) 编辑

2017年3月27日

G - Harmonic Number (II) 找规律--> 给定一个数n,求n除以1~n这n个数的和。n达到2^31 - 1;

摘要: /** 题目:G - Harmonic Number (II) 链接:https://vjudge.net/contest/154246#problem/G 题意:给定一个数n,求n除以1~n这n个数的和。n达到2^31 - 1; 思路: 首先我们观察一下数据范围,2^31次方有点大,暴力会超时,所以我们看看有没有啥规律,假设 tmp 是 n/i 的值,当n == 10的时候(取具体值) 当 t... 阅读全文

posted @ 2017-03-27 21:24 hnust_accqx 阅读(193) 评论(0) 推荐(0) 编辑

2017年3月25日

F - Goldbach`s Conjecture 对一个大于2的偶数n,找有多少种方法使两个素数的和为n;保证素数a<=b; a+b==n; a,b都为素数。

摘要: /** 题目:F - Goldbach`s Conjecture 链接:https://vjudge.net/contest/154246#problem/F 题意:对一个大于2的偶数n,找有多少种方法使两个素数的和为n;保证素数a using namespace std; typedef long long ll; const int maxn = 1e7+10; bool flag[maxn... 阅读全文

posted @ 2017-03-25 21:21 hnust_accqx 阅读(197) 评论(0) 推荐(0) 编辑

E - Leading and Trailing 求n^k得前三位数字以及后三位数字,保证一定至少存在六位。

摘要: /** 题目:E - Leading and Trailing 链接:https://vjudge.net/contest/154246#problem/E 题意:求n^k得前三位数字以及后三位数字,保证一定至少存在六位。 思路:后三位求法只要不断对1000取余就行了。 前三位求法: 对一个数x,他可以用科学计数法表示为10^r*a (r为次方,1 using namespace std; ty... 阅读全文

posted @ 2017-03-25 19:35 hnust_accqx 阅读(212) 评论(0) 推荐(0) 编辑

人性的弱点语录

摘要: 第一章:与人相处的技巧 1,不要批评指责或抱怨 2,给予他人真挚而诚恳的赞美 3,给予别人强烈的欲望 阅读全文

posted @ 2017-03-25 16:46 hnust_accqx 阅读(551) 评论(0) 推荐(0) 编辑

D - Sigma Function 1~n内有多少个约数和为偶数

摘要: /** 题目:D - Sigma Function 链接:https://vjudge.net/contest/154246#problem/D 题意:求1~n内约数和为偶数的数的个数。 思路:一个数的约数和为那个数的每个素因子的等比和相乘。如题目所给公式就是等比和化简之后的式子。 那么要判断一个数约数和是否为偶数,可以通过观察它的各个素因子等比和来判断。如果存在某个素因子的等比和为偶数。 那么... 阅读全文

posted @ 2017-03-25 11:31 hnust_accqx 阅读(350) 评论(0) 推荐(0) 编辑

导航