It's Bessie's birthday and time for party games! Bessie has instructed the N (1 <= N <= 100,000) cows conveniently numbered 1..N to sit in a circle (so that cow i [except at the ends] sits next to cows i-1 and i+1; cow N sits next to cow 1). Meanwhi…
筛法. 枚举每个数,它会对它的倍数的答案有贡献. 数大了以后,倍数相应少了很多.比枚举每个数的约数要好的多. 自己yy了一种分步做法.小于sqrt(m)被当作约数枚举,大于sqrt(m)的枚举倍数. #include<cstdio> #include<algorithm> #include<cstring> using namespace std; + ; int a[maxn],cnt[maxn]; int n,maxa,s[maxn]; int main() { s…