2017年3月31日

GCD - Extreme (II) for(i=1;i<N;i++) for(j=i+1;j<=N;j++) { G+=gcd(i,j); } 推导分析+欧拉函数

摘要: /** 题目:GCD - Extreme (II) 链接:https://vjudge.net/contest/154246#problem/O 题意: for(i=1;i gcd(x/i,n/i)=1;那么x/i的个数为(n/i)的欧拉函数值phi(n/i); 那么:f[n] = sum(i*phi(n/i)) (i为n的约数) 求每个f[n]不需要对每一个n单独求约数。 可以利用素数筛法类似... 阅读全文

posted @ 2017-03-31 20:33 hnust_accqx 阅读(1883) 评论(0) 推荐(0) 编辑

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) 编辑

导航