题目:https://codeforces.com/problemset/problem/711/C 题意:给你n,m,k,代表n个数的序列,有m种颜色可以涂,0代表未涂颜色,其他代表已经涂好了,连着一段是相同颜色的是一个连通块,求正好有k个连通块的最小花费 思路:首先每个位置有可能有m中颜色,而且要满足k个,我们我们可以推出所有情况 dp[n][m][k] n代表前n个数 m代表当前涂m色 k代表满足k个了 #include<cstdio> #include<cmath> #in…
Coloring Trees Problem Description: ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n fr…
C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be…
C. Coloring Trees 题目连接: http://www.codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The…
C. Coloring Trees   ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to n from left to right…
题目链接 http://codeforces.com/contest/711/problem/C Description ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered wit…
题目大意:有n个点,由m种颜料,有些点没有涂色,有些点已经涂色了,告诉你每个点涂m种颜色的价格分别是多少, 让你求将这n个点分成k段最少需要多少钱. 思路:动态规划,我们另dp[ i ][ j ][ k ] 表示到i个点为止,分成j段,最后一段的颜色为k的最少值,然后就能很容易地 写出状态转移方程. #include<bits/stdc++.h> #define ll long long using namespace std; ; const ll inf=0x3f3f3f3f3f3f3f3…
C. Writing Code Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/544/problem/C Description Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers working o…
题目链接: http://codeforces.com/problemset/problem/149/D D. Coloring Brackets time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Toda…
题目链接:https://vjudge.net/problem/CodeForces-149D D. Coloring Brackets time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Once Petya read a problem about a bracket sequence. He gave it much tho…