题意:求$F(b) F(a 1),F(n)=\sum_{i=1}^n\sum_{j=1}^i\frac{i}{(i,j)}$ 题解:先枚举gcd,$=\sum_{d=1}^n\sum_{i=1}^{\lfloor \frac{n}{d} \rfloor}\sum_{j=1}^i j[gcd(i,j) ...
分类:
其他好文 时间:
2018-10-04 19:30:13
阅读次数:
128
第一题: 轮廓线DP,从后往前存;复杂度R*C*2^16; 学习了一波std的写法,非常优美; #include<bits/stdc++.h> using namespace std; const int M = (1<<16) + 1; int dp[2][M], cnt[M], len[130] ...
分类:
其他好文 时间:
2018-10-04 18:23:16
阅读次数:
147
题意:$\sum_{i=1}^n\sum_{j=1}^ngcd(i,j)$ 题解:先枚举gcd,$\sum_{d=1}^n\sum_{i=1}^{\lfloor \frac{n}{d} \rfloor}\sum_{j=1}^{\lfloor \frac{n}{d} \rfloor}[(i,j)=1] ...
分类:
其他好文 时间:
2018-10-04 14:31:58
阅读次数:
213
题意:求$\sum_{i=1}^n\sum_{j=1}^n\frac{i j}{gcd(i,j)}$ 题解:先枚举gcd,$\sum_{d=1}^nd\sum_{i=1}^{\lfloor \frac{n}{d} \rfloor}\sum_{j=1}^{\lfloor \frac{n}{d} \rf ...
分类:
其他好文 时间:
2018-10-04 13:47:15
阅读次数:
258
一:整除与约数 整除:若整数a除以非零整数b,商为整数,且余数为0,我们就说a能被b整除(或者说b整除a),记作b|a。 约数:如果d|a且d>=0,则称d是a的约数。 二:素数与合数 素数:如果一个整数a>1且只能被平凡数1和它自身所整除,则称这个数是素数(质数)。 合数:如果一个整数a>1且不是 ...
分类:
其他好文 时间:
2018-10-04 10:50:59
阅读次数:
634
题目链接 2015 ACM-ICPC Shenyang Problem A Problem B Problem C Problem D 签到题,所有gcd的倍数都可以被写出来。 那么判断一下这类数的个数的奇偶性就可以了。 Problem E Problem F Problem G Problem H ...
分类:
其他好文 时间:
2018-10-04 10:28:46
阅读次数:
280
远古时期就做过的模拟赛 依然无法AK 第一题数组还爆了 T1 万圣节的入场券 题目大意: 有n+1个数 其中有n个真的数 为一个合数x*互不相同的质数 另一个假的数 /x 后不为质数 给n+1个数 求其中那个假的数 思路: 可以两两求gcd 其中出现最多的那个gcd为x 若一个数不能整除x或除x后大 ...
分类:
其他好文 时间:
2018-10-04 10:26:42
阅读次数:
115
#include using namespace std; int main(){ int T,n,m;scanf("%d",&T); while(T --){ scanf("%d",&n); long long nksum = 0, sum = 0; for(int i = 0; i < n; i... ...
分类:
其他好文 时间:
2018-10-04 09:59:59
阅读次数:
150
用到了欧几里得算法: int gcd(int a,int b) { if(b==0)return a; gcd(b,a%b); } 这道题强调32位int,所以两个int相乘可能会超范围,所以求最小公倍数时要先除再乘 代码如下: #include<iostream> #include<stdio.h ...
分类:
其他好文 时间:
2018-10-04 09:58:23
阅读次数:
106
[题目链接] https://codeforces.com/contest/986/problem/E [算法] X到Y的路径积 , 可以转化为X到根的路径积乘Y到根的路径积 , 除以LCA到根的路径积 , 再除以LCA父节点到根的路径积 考虑如何计算根到X路径上每个点与Value的GCD之积 不妨 ...
分类:
其他好文 时间:
2018-10-04 09:39:24
阅读次数:
172