hiho week 162 register

Ended

Participants:319

Verdict:Accepted
Score:100 / 100
Submitted:2017-08-06 12:36:50

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int dp[100][100];
int main(){
    string s;
    cin>>s;
    int len=s.length();
    for(int i=len-1;i>=0;i--){
        for(int j=i+1;j<len;j++){
            if(s[i]==s[j]){
               dp[i][j]=dp[i+1][j-1];
            }
            else{
               dp[i][j]=min(min(dp[i+1][j],dp[i][j-1]),dp[i+1][j-1])+1;
            }
        
        }
    
    }
    cout<<dp[0][len-1]<<endl;
    
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX