func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5e2 + 7;   int c[N], n;   int f[N][N];   int main() {     memset(f, 0x7f7f, sizeof f);     scanf( %d , &n);     for (register int i = 1; i <= n; ++i) {       scanf( %d , &c[i]);       f[i][i] = 1;     }     for (register int i = 1; i < n; ++i) {       if (c[i] == c[i + 1])         f[i][i + 1] = 1;       else         f[i][i + 1] = 2;     }     for (register int le = 3; le <= n; ++le)       for (register int l = 1, r = l + le - 1; r <= n; l++, r++) {         if (c[l] == c[r]) f[l][r] = f[l + 1][r - 1];         for (register int k = l; k < r; ++k)           f[l][r] = min(f[l][r], f[l][k] + f[k + 1][r]);       }     cout << f[1][n];     return 0;   }   