传送门

分析

见ptx大爷博客

代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
const int mod = 1e9+;
int dp[][],n,m;
char s[];
inline int pw(int x,int p){
x%=mod;
int res=;
while(p){
if(p&)res=(long long)res*x%mod;
x=(long long)x*x%mod;
p>>=;
}
return res;
}
int main(){
int i,j,k;
scanf("%d",&n);
scanf("%s",s);
m=strlen(s);
dp[][]=;
for(i=;i<=n;i++)
for(j=;j<=i;j++){
if(j)dp[i][j]=(dp[i][j]+dp[i-][j-]*)%mod;
if(j==)dp[i][j]=(dp[i][j]+dp[i-][j])%mod;
dp[i][j]=(dp[i][j]+dp[i-][j+])%mod;
}
int Ans=(long long)dp[n][m]*pw(pw(,m),mod-)%mod;
printf("%d\n",Ans);
return ;
}

ARC059F的更多相关文章

  1. AtCoder 杂题训练

    前言: 因为要普及了,今年没一等就可以退役去学文化课了,所以暑假把历年noip普及组都刷了一遍,离noip还有50+天,想弄点强化训练什么的. 想了想,就这些天学文化课之余有空就把AtCoder之前那 ...

随机推荐

  1. Servlet细节处理

    1.Servlet的线程安全问题 尽管servlet的工作效率高,但是线程也是不安全的,因为一个类型的Servlet只有一个实例对象,那么就有可能会出现一个Servlet同时处理多个请求 解决方案:所 ...

  2. BZOJ1280: Emmy卖猪pigs

    BZOJ1280: Emmy卖猪pigs https://lydsy.com/JudgeOnline/problem.php?id=1280 分析: 这题感觉还好,因为是有时间顺序,所以拆点做最大流即 ...

  3. LeetCode Student Attendance Record I

    原题链接在这里:https://leetcode.com/problems/student-attendance-record-i/description/ 题目: You are given a s ...

  4. DOS命令查询当前文件夹中文件数量

    太牛X,太实用,因此单独记下 1. 仅统计文件数量 dir /b /a-d | find /v /c "&#@" 2. 统计文件和目录总数量 dir /b | find / ...

  5. unitychan-crs 头发随动脚本

    // //SpringCollider for unity-chan! // //Original Script is here: //ricopin / SpringCollider.cs //Ro ...

  6. 最终还是选择了markdownpad2

    markdownpad2使用 最终 哈哈,最后还是选择了markdownpad2,经过探索才知道这个玩意多么好用. 点击,下载. 碰到的问题 1.win10出现HTML无法渲染得对话框 结果是,官网有 ...

  7. mysql 备份语句

    模板: mysqldump -h IP -u user -p 选项 dbname>d:\db.sql 选项:-f表示有错误时继续 -d 表示--no-create-db, -n表示--no-da ...

  8. [置顶] strcpy()与strncpy()的区别

    头文件:#include <string.h> strcpy() 函数用来复制字符串,其原型为: char *strcpy(char *dest, const char *src); [参 ...

  9. spring--AOP--日志---demo1---bai

    AOP日志DEMO1: 实体类: package com.etc.entity; import org.aspectj.lang.annotation.Pointcut; public class U ...

  10. Android 音频播放分析笔记

    AudioTrack是Android中比较偏底层的用来播放音频的接口,它主要被用来播放PCM音频数据,和MediaPlayer不同,它不涉及到文件解析和解码等复杂的流程,比较适合通过它来分析Andro ...