codeforces——432A—— Choosing Teams
来源:互联网 发布:windows isa 编辑:程序博客网 时间:2024/05/22 13:25
The Saratov State University Olympiad Programmers Training Center (SSU OPTC) hasn 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 leastk times?
The first line contains two integers, n andk (1 ≤ n ≤ 2000; 1 ≤ k ≤ 5). The next line containsn integers: y1, y2, ..., yn(0 ≤ yi ≤ 5), whereyi shows the number of times thei-th person participated in the ACM ICPC world championship.
Print a single number — the answer to the problem.
5 20 4 5 1 0
1
6 40 1 2 3 4 5
0
6 50 0 0 0 0 0
2
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.
求参加比赛次数加上 k 值,小于等于5的人,能组成几队(每队必须有三个人组成,每个人仅能参加一个队)
水
#include <iostream>#include <deque>#include <cstring>#include <algorithm>#include <stdio.h>#include <map>#include <vector>#include <iomanip>#include <string>#include <cstring>#include <functional>#include <queue>using namespace std;int main(){ int n,m; while(cin>>n>>m) { int ans=0,temp=5-m; while(n--) { int temp2; cin>>temp2; if(temp2<=temp) ans++; } cout<<ans/3<<endl; } return 0;}
- codeforces——432A—— Choosing Teams
- Codeforces 432A Choosing Teams
- Codeforces 432 A. Choosing Teams
- Codeforces 432A Choosing Teams
- Codeforces 432A Choosing Teams(水题)
- Codeforces #246 (Div. 2) A. Choosing Teams
- Codeforces #246 (Div. 2) A. Choosing Teams
- A. Choosing Teams
- Codeforces Round #246 (Div. 2) - A. Choosing Teams
- Codeforces Round #246 (Div. 2) A. Choosing Teams
- Codeforces Round #246 (Div. 2):A. Choosing Teams
- Codeforces Round #246 (Div. 2) A. Choosing Teams
- CF 246 A Choosing Teams
- Choosing Teams
- Choosing Teams
- 大学英语六级听力——015(Choosing a Career)
- 6——Choosing a Microservices Deployment Strategy
- 【打CF,学算法——三星级】CodeForces 216B Forming Teams (图论)
- MySql计划事件开启
- java基础 记录
- 《操作系统》 先来先服务FCFS和短作业优先SJF进程调度算法相关计算及实验
- C语言?Go语言?还是CGO语言!
- 设计模式-中介者模式
- codeforces——432A—— Choosing Teams
- elasticsearch Getting start
- Doctor项目中曾经查过的资料
- js变量声明提升
- python 多线程详解
- JavaScript抽奖翻牌游戏/定义数组保存传入参数数组,避免操作传入数组/洗牌动作队列洗牌及翻牌效果
- 如何正确配置 Nginx+PHP
- quick-cocos2d-x中的ListView详解
- JUnit4写测试用例异常: java.lang.Exception: No tests found matching处理办法