Choosing Teams

简介: Choosing Teams

文章目录

一、A. Choosing Teams

总结


一、A. Choosing Teams

本题链接:A. Choosing Teams


题目:


A. Chooing Teams


time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output


The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has n students. For each student you know the number of times he/she has participated in the ACM ICPC world programming championship. According to the ACM ICPC rules, each person can participate in the world championship at most 5 times.


The head of the SSU OPTC is recently gathering teams to participate in the world championship. Each team must consist of exactly three people, at that, any person cannot be a member of two or more teams. What maximum number of teams can the head make if he wants each team to participate in the world championship with the same members at least k times?


Input

The first line contains two integers, n and k (1 ≤ n ≤ 2000; 1 ≤ k ≤ 5). The next line contains n integers: y1, y2, …, yn (0 ≤ yi ≤ 5), where yi shows the number of times the i-th person participated in the ACM ICPC world championship.


Output

Print a single number — the answer to the problem.


Examples

input

5 2

0 4 5 1 0

output

1

input

6 4

0 1 2 3 4 5

output

0

input

6 5

0 0 0 0 0 0

output

2


Note

In the first sample only one team could be made: the first, the fourth and the fifth participants.


In the second sample no teams could be created.


In the third sample two teams could be created. Any partition into two teams fits.


本博客给出本题截图:

3.png

题意:每个人只能最多参赛5次,每人每次比赛只能在一支队伍中,每支队伍必须是3个人,下面给出n个队员的参赛次数,问如果这些人还要参赛k次,最多还能组成几支队伍

AC代码

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

总结

水题,不解释

目录
相关文章
如何在edge上安装拓展weTab
如何在edge上安装拓展weTab
212 0
|
JavaScript API
Vue使用vue-3d-model组件预览3D三维文件、立体文件,支持旋转、自动播放
Vue使用vue-3d-model组件预览3D三维文件、立体文件,支持旋转、自动播放
|
10月前
|
JavaScript API
Vue3基础(24)___vue3中不再支持filters
Vue 3中不再支持filters(过滤器)
168 2
|
9月前
|
人工智能
三文带你轻松上手鸿蒙的AI语音03-文本合成声音
三文带你轻松上手鸿蒙的AI语音03-文本合成声音
232 1
三文带你轻松上手鸿蒙的AI语音03-文本合成声音
|
11月前
|
SQL Java 数据库连接
后端框架的学习----mybatis框架(7、使用注解开发)
这篇文章讲述了如何使用MyBatis框架的注解方式进行开发,包括在接口上使用注解定义SQL语句,并通过动态代理实现对数据库的增删改查操作,同时强调了接口需要在核心配置文件中注册绑定。
|
程序员 开发工具
Vim命令大全:掌握编辑利器
Vim命令大全:掌握编辑利器
|
机器学习/深度学习 安全 网络安全
利用深度学习优化图像识别流程网络安全与信息安全:防范漏洞、强化加密、提升意识
【5月更文挑战第27天】 在本文中,我们探索了深度学习技术如何革新传统的图像识别过程。通过构建一个基于卷积神经网络(CNN)的模型,我们展示了从数据预处理到特征提取再到分类决策的整个优化流程。实验结果表明,该模型在处理复杂图像数据集时,不仅提高了识别准确率,还显著缩短了处理时间。文章最后讨论了模型在现实世界应用中的潜力以及未来改进的方向。 【5月更文挑战第27天】在数字时代,网络安全与信息安全已成为全球关注的焦点。本文将深入探讨网络安全漏洞的成因与危害,加密技术的重要性及其应用,以及提升公众安全意识的必要性。通过对这些关键领域的分析,我们旨在为读者提供一套全面的安全防护策略,以应对日益复杂的
|
前端开发 应用服务中间件 nginx
Nginx 简单介绍(一)
如果我们想要将数据转接到多个服务器可以这样写: [^1]
97 0
|
Java Linux Spring
centos7系统运行、停止java程序常用命令,springboot打包运行
centos7系统运行、停止java程序常用命令,springboot打包运行
1398 0
centos7系统运行、停止java程序常用命令,springboot打包运行