当前位置:网站首页>Educational Codeforces Round 20 F. Coprime Subsequences
Educational Codeforces Round 20 F. Coprime Subsequences
2022-06-09 05:55:00 【不吃土司边】
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
const int maxn = 1e5+2;
const int maxm=1e5;
const int INF = 1<<30;
const int mod = 1e9+7;
#define int long long
int n,a[maxn],cnt[maxn];
int dp[maxn],p[maxn];
void solve(){
p[0]=1;for(int i=1;i<maxn;i++) p[i]=p[i-1]*2,p[i]%=mod;
scanf("%lld",&n);for(int i=1;i<=n;i++) scanf("%lld",&a[i]),cnt[a[i]]++;
for(int i=maxn;i>=1;i--){
for(int j=1;j*i<=maxm;j++){
dp[i]=(dp[i]+cnt[i*j])%mod;
}
dp[i]=p[dp[i]]-1;
for(int j=2;j*i<=maxm;j++){
dp[i]=(dp[i]-dp[i*j]+mod)%mod;
}
// cout<<dp[i]<<endl;
}
cout<<dp[1]<<endl;
return;
}
int32_t main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
猜你喜欢

srs-nodejs

三大队列cxq,entrylist,waitset 个人理解分析

MySQL add field or create table SQL statement

Mysql5.7 dual master and dual slave configuration

Complete jitsi meet guide for webrtc

Quelles sont les informations contenues dans le certificat SSL?

Here comes the era of metaltc2.0

Embedded audio and video solutions webrtc vs metartc

Interpretation of join method in thread

arthas-boot
随机推荐
Yolov5-6.0系列 | yolov5的模型网络构建
使用MAT进行内存问题定位
Velocity VM template code format problem
使用 __proto__ 来分配原型
[paper] cbam: revolutionary block attention module
Entity to map tool
MVCC多版本控制
XML建模
pytorch with Automatic Mixed Precision(AMP)
使用点云数据创建数字高程模型(DEM)
Complete jitsi meet guide for webrtc
A pit for writing Oracle statements
Quelles sont les informations contenues dans le certificat SSL?
Morsel driven parallelism: a NUMA aware parallel query execution framework
Topic26——11. Container with the most water
Record an opensips DNS problem
1433:【例题1】愤怒的牛
Image processing feature fusion correlation extension
Synchronized detailed parsing
One side of a small company in Hangzhou