Codeforces Round #216 (Div. 2)A. Valera and Plates

OpenSoucre發表於2014-03-15
#include <iostream>

using namespace std;

int main(){
    int n, m , k;
    cin >> n >> m >> k;
    int first_type = 0, second_type = 0;
    for(int i = 0 ;  i < n ; ++ i){
        int a;
        cin >> a;
        (a == 1) ? first_type++ : second_type ++ ;
    }
    int wash_number = 0;
    if(first_type - m  >= 0 ){
        wash_number = first_type - m;
        m = 0;
    }else{
        m -=first_type;
    }
    if(second_type - m > 0){
        second_type-=m;
        wash_number += (second_type-k > 0 ? second_type-k : 0);
    }
    cout<<wash_number<<endl;
}

 

相關文章