思路: dp[i][j]表示到第i个砖块为止共计有j个砖块和它左边的砖块颜色不同. 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; ; ll dp[][]; int main() { int n, m, k; while (cin >> n >> m >> k) { memset(dp, , sizeof dp); dp[][] = m; ; i <= n;…
传送门:http://codeforces.com/contest/1081/problem/C C. Colorful Bricks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On his free time, Chouti likes doing some housework. He has got one new…
On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard. There are nn bricks lined in a row on the ground. Chouti has got mm paint buckets of different colors at hand, so he painted each brick in on…
DP? Problem Description Figure 1 shows the Yang Hui Triangle. We number the row from top to bottom 0,1,2,…and the column from left to right 0,1,2,….If using C(n,k) represents the number of row n, column k. The Yang Hui Triangle has a regular pattern…