某种意义上真毒瘤?我没看懂题啊...于是看了题解 就是筛约数的那种方法,复杂度调和级数保证O(nlogn) 所以这题啥意思啊 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=1000005; int n,mx,a[N],c[N],d[N]; int read() { int r=0,f=1; char p=getchar(); while(p…
筛法. 枚举每个数,它会对它的倍数的答案有贡献. 数大了以后,倍数相应少了很多.比枚举每个数的约数要好的多. 自己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…
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…
-------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #define rep( i , n ) for( int i = 0 ; i < n ; ++i ) #define clr( x , c ) memset( x…
题面:P2925 [USACO08DEC]干草出售Hay For Sale 题解:无 代码: #include<cstdio> #include<cstring> #include<iostream> using namespace std; ,maxh=; int C,H,V[maxh]; bool F[maxc]; int main(){ scanf("%d%d",&C,&H); ;i<=H;i++)scanf("…