没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
DP+字典树
题目给出已经是字典序了,直接按照输入插入
每次插入前把当前串按题目的意思枚举可构造的串,然后去字典树查。
保存一个最大值。
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
typedef __int64 lld;
const int MAX=500005;
struct NODE
{
int next[26],dp;
}node[MAX];
int tot=-1;
void clr()
{
tot++;
memset(node[tot].next,-1,sizeof(node[tot].next));
node[tot].dp=0;
}
void ins(char s[],int dp)
{
int h=0,tmp,i;
for(i=0;s[i];i++)
{
tmp=s[i]-'a';
if(node[h].next[tmp]==-1)
{
题目给出已经是字典序了,直接按照输入插入
每次插入前把当前串按题目的意思枚举可构造的串,然后去字典树查。
保存一个最大值。
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
typedef __int64 lld;
const int MAX=500005;
struct NODE
{
int next[26],dp;
}node[MAX];
int tot=-1;
void clr()
{
tot++;
memset(node[tot].next,-1,sizeof(node[tot].next));
node[tot].dp=0;
}
void ins(char s[],int dp)
{
int h=0,tmp,i;
for(i=0;s[i];i++)
{
tmp=s[i]-'a';
if(node[h].next[tmp]==-1)
{
资源评论
- hllcsd2013-08-17解题报告不够完整。只有简单的说明和代码。不过代码还是很清楚。
Flyfingers
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功