本文主要是介绍uva 11552 - Fewest Flops(dp),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
题目链接:uva 11552 - Fewest Flops
题目大意:给定一个k,和一个字符串,字符串长度是k的倍数,将字符串分成len/k份,每一份中的字母可以任意交换位置,现在要求每一份中的字母重排之后,字母块数最小。
解题思路:dp[i][j]表示在第i/k份以j字符结尾的字母块数。
#include <stdio.h>
#include <string.h>
#include <algorithm>using namespace std;
const int N = 1005;
const int M = 30;
const int INF = 0x3f3f3f3f;i
这篇关于uva 11552 - Fewest Flops(dp)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!