当前位置:网站首页>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;
}
边栏推荐
- PTA class a simulated sixth bomb: 1156-1159
- biggan:large scale gan training for high fidelity natural image synthesis
- 二造实务案例答题技巧和举例汇总,满满都是精髓
- Dazhou suggested that we media bloggers do these four things in the early stage
- 关于strlen与sizeof的区别
- SDRAM控制器——添加读写FIFO
- Easyexcel read file
- vtk初始化代码学习1
- Multi type study of Worthington collagen protease
- Record a weird picture upload problem
猜你喜欢

tos cos dscp 区别和作用

Sweet girl lisixia was invited to be the little host of the global finals of the sixth season perfect child model

shell学习记录(二)

shell学习记录(一)

FPGA实现图像二值形态学滤波——腐蚀膨胀

Xiaomi tablet 5 Pro unlock bootloader

qtvtkvs2015测试代码

Redis7.0的安装步骤

通俗易懂C语言关键字static

Playful girl wangyixuan was invited to serve as the Promotion Ambassador for the global finals of the sixth season perfect children's model
随机推荐
Connectez Le projecteur
readv & writev
Redis7.0的安装步骤
标定。。。
-- EGFR FISH probe solution
Finding the sum of N multiplications
cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network
vscode调试时提示更新到最新调试版本
如何高效的完成每日的任务?
keda 2.7.1 scaledJob 代码简要分析
Sweet cool girl jinshuyi was invited to be the spokesperson for the global finals of the sixth season perfect children's model
LeetCode 31 ~ 40
recvmsg & sendmsg
Detailed explanation of memory leak check tools
Chinese and English instructions of collagen enzyme Worthington
General introduction to gun make (2)
shell学习记录(二)
Show spirit chenzitong was invited to be the chief experience officer of the global finals of the sixth season perfect children's model
How to add a "security lock" to the mobile office of government and enterprises?
About vs scanf, 'scanf' appears: this function or variable may be unsafe Solutions to the problem of consumer usi