1. 程式人生 > >Codeforces Round #493 (Div. 1)

Codeforces Round #493 (Div. 1)

nbsp dig stream out can sdi set include cout

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)