首页 > 代码库 > Codeforces Round #246 (Div. 2) A. Choosing Teams

Codeforces Round #246 (Div. 2) A. Choosing Teams

给定n k以及n个人已参加的比赛数,让你判断最少还能参加k次比赛的队伍数,每对3人,每个人最多参加5次比赛

#include <iostream>
using namespace std;
int main(){
    int n,k, cnt = 0;
    cin >> n >> k;
    for(int i = 0 ; i < n; ++ i){
        int a;
        cin >> a;
        if(a+k <= 5) cnt ++;
    }
    cout<<cnt/3<<endl;
}