七夕节 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 56666 Accepted Submission(s): 18239 Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!"人们纷纷来到告示…
Just Do It Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1552 Accepted Submission(s): 1036 Problem Description Now we define a function F(x), which means the factors of x. In particular, F(…
Recently, the bear started studying data structures and faced the following problem. You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) to represe…
我们一般写的埃氏筛消耗的时间都是欧拉筛的三倍,但是欧拉筛并不好想(对于我这种蒟蒻) 虽然 -- 我 -- 也可以背过模板,但是写个不会的欧拉筛不如写个简单易懂的埃氏筛 于是就有了优化 这个优化还是比较厉害的,能把埃氏筛的消耗的时间提的跟欧拉筛差不多 以下内容需要先学会埃氏筛 学会的埃氏筛就明白它的原理了吧 #include<bits/stdc++.h> using namespace std; int n, m ,Is_p[10000001]; int main() { cin >>…
从2e5-1依次枚举每个数作为主显卡,然后分段求比它大的数的个数,这里的复杂度是调和级数ln2e5,即埃氏筛的复杂度.. #include<bits/stdc++.h> using namespace std; #define ll long long #define N 200005 int cnt[N],n; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 ll num[N<<]; void updat…