• 比赛状态堪忧,笑看自己找不着北..
  • 把心态放好吧- -
  • 反正窝从一開始就仅仅是为了多学习才上道的
  • 至少已经从学习和智商上给窝带来了一些帮助
  • 智商带不动,好辛苦~~~~(>_<)~~~~ 
  • 说说这题吧…这题就是个SB题。考虑前i个字符能匹配的方案数。我们仅仅须要考虑它后几位是否能配上一组题目给出的字符就可以,于是有
    dp[i]=∑j=1ndp[j](if.字符[j,i]匹配上了某一组给定字符)
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; const int MAX = 128 << 2;
int dp[MAX];
char rp[MAX >> 2][6] =
{
"4", "|3", "(", "|)", "3", "|=", "6", "#", "|",
"_|", "|<", "|_", "|\\/|", "|\\|", "0", "|0", /*-P*/
"(,)", "|?", "5", "7", "|_|", "\\/", "\\/\\/",
"><", "-/", "2"
}; int main()
{
char buffer[MAX];
char s[MAX];
while (cin >> buffer && buffer[0] != 'e')
{
s[0] = '\0';
int len = strlen(buffer);
for (int i = 0; i < len; ++i)
{
strcat(s, rp[buffer[i] - 'A']);
}
len = strlen(s); memset(dp, 0, sizeof(dp));
for (int i = 0; i < len; ++i)
{
char ch = s[i + 1];
s[i + 1] = '\0';
for (int t = 0; t < 26; ++t)
{
if (strcmp(rp[t], s) == 0)
{
++dp[i];
break;
}
} for (int j = 1; j <= i; ++j)
{
for (int t = 0; t < 26; ++t)
{
if (strcmp(rp[t], s + j) == 0)
{
dp[i] += dp[j - 1];
}
}
}
s[i + 1] = ch;
}
cout << dp[len - 1] << endl;
}
return 0;
}

poj3073的更多相关文章

  1. django 操作数据库--orm(object relation mapping)---models

    思想 django为使用一种新的方式,即:关系对象映射(Object Relational Mapping,简称ORM). PHP:activerecord Java:Hibernate C#:Ent ...

随机推荐

  1. /struts-tags not found ,/struts-dojo-tags not found 上线后异常解决方案

    上线到2003上后发现2个问题:1 缺少/struts-tags2 缺少/struts-dojo-tags在xp上不用直接指定这些文件的位置,但在其他的系统可能无法自动找到它的路径,一定要明确指定在w ...

  2. 解决『Manifest merger failed with multiple errors, see 』

    Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multipl ...

  3. WAMP 默认mysql密码修改

    WAMP安装好后,mysql密码是为空的,那么要如何修改呢?其实很简单,通过几条指令就行了,下面我就一步步来操作. 首先,通过WAMP打开mysql控制台. 提示输入密码,因为现在是空,所以直接按回车 ...

  4. [转]@Transactional spring 配置事务 注意事项

    @Transactional spring 配置事务 注意事项 [@more@] @Transactional spring 配置事务 注意事项 1. 在需要事务管理的地方加@Transactiona ...

  5. Android新特性--ConstraintLayout完全解析

    Android新特性--ConstraintLayout完全解析 本篇文章的主题是ConstraintLayout.其实ConstraintLayout是Android Studio 2.2中主要的新 ...

  6. haproxy 非常完整的配置

    常用配置选项: OPTION 选项: option httpclose :HAProxy会针对客户端的第一条请求的返回添加cookie并返回给客户端,客户端发送后续请求时会发送 此cookie到HAP ...

  7. java服务端技术

    服务端框架:1.servlet2.netty 协议:1.http 1.02.http 1.1 数据库:mysql 对象关系映射(ORM)框架:mybatis 缓存:redis eclipse能运行,导 ...

  8. (转载)javascript将base64编码的图片数据转换为file并提交

    /** * @param base64Codes * 图片的base64编码 */ function sumitImageFile(base64Codes){ var form=document.fo ...

  9. KVM虚拟机安装报错 KVM is not available

    在linux系统上使用kvm安装系统时,如果你的cpu不支持虚拟化技术那么可能会报以下错误: Warning:KVM is not available. This may mean the KVM p ...

  10. c++11实现c++14的optional

    c++14中将包含一个std::optional类,它的功能和用法和boost的optional类似.optional<T>内部存储空间可能存储了T类型的值也可能没有存储T类型的值,只有当 ...