如果输入为4 1 1 1 8 1,那么程序会输出()。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, a, b, c=0, bad=0;
cin >> n >> a >> b;
for(int i = 1; i <= n; i++)
{
int t;
cin >> t;
if(t == 1)
{
if(a) a--;
else if(b) b--, c++;
else if(c) c--;
else bad++;
}
else
{
if(b) b--;
else bad += 2;
}
}
cout << bad << endl;
return 0;
}
0
1
2
3