设为首页 加入收藏

TOP

HDU 4628 Pieces
2014-11-23 21:54:21 来源: 作者: 【 】 浏览:9
Tags:HDU 4628 Pieces

Pieces
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 337 Accepted Submission(s): 186


Problem Description
You heart broke into pieces.My string broke into pieces.But you will recover one day,and my string will never go back.
Given a string s.We can erase a subsequence of it if this subsequence is palindrome in one step.We should take as few steps as possible to erase the whole sequence.How many steps do we need
For example, we can erase abcba from axbyczbea and get xyze in one step.

Input
The first line contains integer T,denote the number of the test cases. Then T lines follows,each line contains the string s (1<= length of s <= 16).
T<=10.

Output
For each test cases,print the answer in a line.

Sample Input
2
aa
abb

Sample Output
1
2

Source
2013 Multi-University Training Contest 3

Recommend
zhuyuanchen520

#include    
#include    
#include    
#include    
#define N 20   
#define M 1<<16   
using namespace std;  
int dp[M];  
char s1[N],s2[N];  
bool check[M];  
int main()  
{  
    //freopen("data1.in","r",stdin);   
    int t;  
    scanf("%d",&t);  
    while(t--)  
    {  
        scanf("%s",s1);  
        int l = strlen(s1);  
        int x,u;  
        for(int i=0;i<=(1< 
 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇HDU 1466 计算直线的交点数 下一篇UVA 10014 Simple calculations

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis压力测试实战 - (2025-12-27 09:20:24)
·高并发一上来,微服 (2025-12-27 09:20:21)
·Redis 高可用架构深 (2025-12-27 09:20:18)
·Linux 系统监控 的完 (2025-12-27 08:52:29)
·一口气总结,25 个 L (2025-12-27 08:52:27)