首页 > 代码库 > CodeForces 369A Valera and Plates( 水)

CodeForces 369A Valera and Plates( 水)

技术分享
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int bowl,plate;int n;int dish[1100];int main(){    int i,j;    while(scanf("%d%d%d",&n,&bowl,&plate)!=EOF)    {        int ans=0;        for(i=1;i<=n;i++)        {            scanf("%d",&dish[i]);        }        for(i=1;i<=n;i++)        {            if(dish[i]==1)            {                if(bowl>0)                {                    bowl--;                }                else if(bowl==0)                {                    ans++;                }            }            else if(dish[i]==2)            {                if(plate>0)                {                    plate--;                }                else if(bowl>0)                {                    bowl--;                }                else                {                    ans++;                }            }        }        printf("%d\n",ans);    }    return 0;}
View Code

 

CodeForces 369A Valera and Plates( 水)