| 比赛 | 
    名字我取了 | 
    评测结果 | 
    AAAAAAAAAA | 
    | 题目名称 | 
    餐馆的桌子 | 
    最终得分 | 
    100 | 
    | 用户昵称 | 
    123 | 
    运行时间 | 
    0.027 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.31 MiB  | 
    | 提交时间 | 
    2017-09-15 19:38:45 | 
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int n,m,i,j;
int main(){
	freopen ("RT.in","r",stdin);
	freopen ("RT.out","w",stdout);
	int a,b,c,i,j;
	cin>>n>>i>>j;
	int x1=0,y1=0,y2=0,ans=0;
	for(a=1;a<=n;a++)
	{
		scanf("%d",&m);
		if(m==1)
		{
			if(x1<i)
				x1++;
			else
			{
				if(y1+y2<j)
				{
					y1++;
					continue;
				}
				if(y1+y2==j)
				{
					if(y1==0)
						ans++;
					else
					{
						y1--;
						y2++;
					}
				}
			}
		}
		else
		{
			if(y1+y2<j)
				y2++;
			else
				ans+=2;
		}
	}
	printf("%d",ans);
	return 0;
}