Codeforces Round 71
Posted aiahtwo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round 71相关的知识,希望对你有一定的参考价值。
第一题:读题+基础贪心
http://codeforces.com/contest/1207
第二题:思维题
题意:对于
第三题:
大佬们的dp写法:
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5+5; const int inf = 0x3f3f3f3f; ll T, n, a, b, dp[maxn][2]; char s[maxn]; int main() cin >> T; while(T--) memset(dp, inf, sizeof(dp)); cin >> n >> a >> b; scanf("%s", s+1); dp[0][0] = b; for (int i = 1; i <= n; i++) if (s[i] == ‘0‘) dp[i][0] = min(dp[i][0], dp[i-1][0]+a+b); dp[i][0] = min(dp[i][0], dp[i-1][1]+2*a+2*b); dp[i][1] = min(dp[i][1], dp[i-1][0]+2*a+b); dp[i][1] = min(dp[i][1], dp[i-1][1]+a+2*b); cout << dp[n][0] << endl; return 0;
以上是关于Codeforces Round 71的主要内容,如果未能解决你的问题,请参考以下文章
There Are Two Types Of Burgers (Educational Codeforces Round 71)
Educational Codeforces Round 71 (Rated for Div. 2)
Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations
Educational Codeforces Round 71 (Rated for Div. 2) B - Square Filling
Educational Codeforces Round 71 (Rated for Div. 2) A - There Are Two Types Of Burgers
E. XOR Guessing 交互题 Educational Codeforces Round 71 (Rated for Div. 2)