Codeforces Round #493 (Div. 1)
Posted luoyibujue
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #493 (Div. 1)相关的知识,希望对你有一定的参考价值。
A.
/* 发现每次反转或者消除都会减少一段0 当0只有一段时只能消除 这样判断一下就行 */ #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include<set> #include<map> #define M 300010 #define ll long long using namespace std; int read() { int nm = 0, f = 1; char c = getchar(); for(; !isdigit(c); c = getchar()) if(c == ‘-‘) f = -1; for(; isdigit(c); c = getchar()) nm = nm * 10 + c - ‘0‘; return nm * f; } ll n,x,y; char s[M]; int main() { n = read(), x = read(), y = read(); scanf("%s", s + 1); int len = strlen(s + 1); s[0] = ‘?‘; ll tot = 0; for(int i = 1; i <= len; i++) if(s[i] != s[i - 1] && s[i] == ‘0‘) tot++; if(tot == 0) return puts("0"); cout << min(tot * y, tot * x - x + y); return 0; }
以上是关于Codeforces Round #493 (Div. 1)的主要内容,如果未能解决你的问题,请参考以下文章
Cutting Codeforces Round #493 (Div. 2)
Codeforces Round #493 (Div. 2) BCutting
Codeforces round 493 Convert to Ones
Codeforces Round #436 E. Fire(背包dp+输出路径)