当前位置:网站首页>Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) D. Felicity‘s Big Secret Revealed
Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) D. Felicity‘s Big Secret Revealed
2022-06-26 02:03:00 【No toast】
#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 = 1048576+10;
const int INF = 1<<30;
const int mod = 1e9+7;
int n,a[80];string s;
int dp[80][maxn],num[80][80];
void solve(){
// cout<<(1<<20)<<endl;
cin>>n>>s;
for(int i=1;i<=n;i++) a[i]=s[i-1]-'0';
for(int i=1;i<=n;i++){
for(int j=i,k=0;j<=n;j++){
k=k*2+a[j];
if(k>20) break;
num[i][j]=k;
}
}
// cout<<num[2][4]<<endl;
for(int i=1;i<=n;i++){
dp[i][0]=1;
for(int j=0;j<=(1<<20)-1;j++){
if(dp[i][j]==0) continue;
for(int k=i;k<=n;k++){
if(num[i][k]==0) continue;
dp[k+1][j|(1<<(num[i][k]-1))]+=dp[i][j];
dp[k+1][j|(1<<(num[i][k]-1))]%=mod;
}
}
}
int ans=0;
for(int i=2;i<=n+1;i++){
for(int j=1;j<=20;j++){
ans=(ans+dp[i][(1<<j)-1])%mod;
}
}
cout<<ans<<endl;
return;
}
int 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;
}
边栏推荐
- Steps of program compilation precompile compilation assembly connection
- Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Hangzhou
- Differences and functions of TOS cos DSCP
- Data analysis - similarities and differences between C-end and b-end data analysis
- Application and chemical properties of elastase
- 如何为政企移动办公加上一道“安全锁”?
- cv==biaoding---open----cv001
- Detailed explanation of memory leak check tools
- Characteristics and related specificity of Papain
- PTA class a simulated 11th bomb: 1124-1131
猜你喜欢

qtvtkvs2015测试代码

Xiaomi tablet 5 Pro unlock bootloader

关于strlen与sizeof的区别

Energetic girl wangyujie was invited to be the spokesperson for the global finals of the sixth season perfect children's model

关于VS scanf出现‘scanf‘: This function or variable may be unsafe. Consider usi问题的解决方法

One minute to understand the difference between synchronous, asynchronous, blocking and non blocking

图形渲染管线

The 19th - 22nd week of scientific research training - about tnet and memnet

-- EGFR FISH probe solution

cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network
随机推荐
Dataframe to list
分布式系统(二)分布式事务的理解
影响个人成长的三个因素
biggan:large scale gan training for high fidelity natural image synthesis
LeetCode 41 ~ 50
静态库动态库的使用
cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network
Pixel6 unlock bootloader
关于strlen与sizeof的区别
shell学习记录(三)
Gun make (5) variables in makefile
PTA class a simulated fifth bomb: 1148-1151
PTA class a simulated seventh bomb: 1160-1163
-- EGFR FISH probe solution
SDRAM控制器——仲裁模块的实现
easyexcel读取文件
Codecraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) C. Felicity is Coming!
接口测试用例设计
V4L2+QT视频优化策略
The first intimate contact of caching technology