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;
}

总结

水题,不解释

目录
相关文章
CentOS7编译安装openssl1.1.1
centos7默认提供的openssl版本是1.0.2的,想要升级openssl版本则需要手动进行编译
|
10月前
|
机器学习/深度学习 人工智能 自然语言处理
三行代码实现实时语音转文本,支持自动断句和语音唤醒,用 RealtimeSTT 轻松创建高效语音 AI 助手
RealtimeSTT 是一款开源的实时语音转文本库,支持低延迟应用,具备语音活动检测、唤醒词激活等功能,适用于语音助手、实时字幕等场景。
2268 18
三行代码实现实时语音转文本,支持自动断句和语音唤醒,用 RealtimeSTT 轻松创建高效语音 AI 助手
|
算法 安全 Linux
Ansible自动化工具copy复制用法
Ansible 中的 copy 模块用于将文件或目录从本地计算机或远程主机复制到远程主机上的特定位置。它是一个功能强大的模块,可用于各种文件传输任务. ### 作用 将配置文件复制到远程服务器 将应用程序部署到远程服务器 将日志文件从远程服务器复制到本地计算机 备份和恢复文件和目录
442 2
Ansible自动化工具copy复制用法
|
机器学习/深度学习 并行计算 PyTorch
ONNX 优化技巧:加速模型推理
【8月更文第27天】ONNX (Open Neural Network Exchange) 是一个开放格式,用于表示机器学习模型,使模型能够在多种框架之间进行转换。ONNX Runtime (ORT) 是一个高效的推理引擎,旨在加速模型的部署。本文将介绍如何使用 ONNX Runtime 和相关工具来优化模型的推理速度和资源消耗。
6471 4
|
安全
PyAlgoTrade 0.20 中文文档(一)(3)
PyAlgoTrade 0.20 中文文档(一)
133 0
|
小程序
深入理解 uni-app 页面生命周期(四)onShareAppMessage
深入理解 uni-app 页面生命周期(四)onShareAppMessage
1600 0
|
消息中间件 Dubbo Java
深度剖析线上应用节点流量隔离技术
深度剖析线上应用节点流量隔离技术
8753 0
CDH和CloudManager概述
CDH和CloudManager概述
719 0
CDH和CloudManager概述
|
SQL 消息中间件 资源调度
首次揭秘!​春晚活动下快手实时链路保障实践
本文由快手开发工程师刘建刚分享,主要介绍春晚活动下快手实时链路保障实践。内容主要包含以下四部分:快手 Flink 简介、春晚实时保障方案、春晚实时大屏、未来规划。
首次揭秘!​春晚活动下快手实时链路保障实践
|
关系型数据库 MySQL