/* HDU 6053 - TrickGCD [ 莫比乌斯函数,筛法分块 ] | 2017 Multi-University Training Contest 2 题意: 给出数列 A[N],问满足: 1 <= B[i] <= A[i] ; 对任意(l, r) (1<=l<=r<=n) ,使得 gcd(bl,...br) >= 2 ; 的 B[N] 数列的个数 分析: 设 gcd(b1,...bn) = k (k >= 2),此时 k 对答案的贡献为 (a1/k)…
TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2523    Accepted Submission(s): 965 Problem Description You are given an array A , and Zhu wants to know there are how many different a…
题目链接 定义f[n]表示n是最大公约数情况下的计数,F[n]为n是公约数情况下的计数 (可以和 http://www.cnblogs.com/Just--Do--It/p/7197788.html hdu1695 进行类比) 显然F[n]和f[n]是满足下面这个关系的 所以,可以用下面这个公式求解f[n] 得到下面的AC代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; #define max(a,b)…
2017 多校2 hdu 6053 TrickGCD 题目: You are given an array \(A\) , and Zhu wants to know there are how many different array \(B\) satisfy the following conditions? \(1≤B_i≤A_i\) For each pair(\(l , r) (1≤l≤r≤n) , gcd(bl,bl+1...br)≥2\) Input The first line…
/* HDU 6168 - Numbers [ 思维 ] | 2017 ZJUT Multi-University Training 9 题意: .... 分析: 全放入multiset 从小到大,慢慢筛 */ #include <bits/stdc++.h> using namespace std; const int N = 125250; int n, s[N]; int a[N], cnt; multiset<int> st; multiset<int>::it…
题意:给出n个数$a[i]$,每个数可以变成不大于它的数,现问所有数的gcd大于1的方案数.其中$(n,a[i]<=1e5)$ 思路:鉴于a[i]不大,可以想到枚举gcd的值.考虑一个$gcd(a_1,a_2,a_3…a_n)=d$,显然每个$a_i$的倍数都满足,有$\frac{a_i}{d}$种方案 那么一个d对答案的贡献为\[\prod_{i=1}^{min(a)}{\lfloor\frac{a_i}{d}\rfloor}    \] 但是所有的d计入会有重复情况,考虑容斥,对d进行素数分…
TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2097    Accepted Submission(s): 816 Sample Input 1 4 4 4 4 4 Sample Output Case #1: 17   Source 2017 Multi-University Training Contest…
TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Problem Description You are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions? * 1≤Bi≤Ai* For…
TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2649    Accepted Submission(s): 1007 Problem Description You are given an array A , and Zhu wants to know there are how many different…
TrickGCD Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3401    Accepted Submission(s): 1268 Problem Description You are given an array A , and Zhu wants to know there are how many different…