Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 为何RE？

Posted by zhanglanqing at 2016-03-15 21:23:28 on Problem 3280
```#include<stdio.h>
#include<iostream>
#include<algorithm>
#define N 2000+3
#define M 58
using namespace std;
int n,m;
char s[N];
char at(int i){//变成从1开始的索引
return s[i-1];
}

int dp[N][N];
int del[M];

void Init(){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
dp[i][j]=-1;
}
}
}
int get(int i,int j){

if(i==0||j==0) cout<<"error?"<<endl;
if(dp[i][j]!=-1){return dp[i][j];}
if(i==j) return dp[i][j]=0;
if(at(i)==at(j)) return dp[i][j]=get(i+1,j-1);
int second,first;
return dp[i][j]=std::min(first,second);
}

int main(){

Init();
freopen("D://in.txt","r",stdin);
scanf("%d%d",&m,&n);
scanf("%s",s);

char c;
int tmpa,tmpb;
for(int i=0;i<m;i++){
getchar();
scanf("%c",&c);
scanf("%d%d",&tmpa,&tmpb);

del[c-'a']=tmpb;
}
cout<<get(1,n)<<endl;
}
```

Followed by: