Choosing Teams
来源:互联网 发布:免费群发软件 编辑:程序博客网 时间:2024/05/02 02:28
http://codeforces.com/contest/432/problem/A
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?
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.
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.
每队参加5场,问,最多能有几对参加.
数组开的太小了.
看清题目
#include<iostream>using namespace std;int a[10000];int main(){ int n,m; while(cin>>n>>m) { int x=0; for(int i=0;i<n;i++) { cin>>a[i]; if(a[i]+m<=5) { x++; } } cout<<x/3<<endl; } return 0;}
- Choosing Teams
- Choosing Teams
- A. Choosing Teams
- CF 246 A Choosing Teams
- Codeforces 432A Choosing Teams
- Codeforces 432 A. Choosing Teams
- Codeforces 432A Choosing Teams
- Codeforces #246 (Div. 2) A. Choosing Teams
- Codeforces 432A Choosing Teams(水题)
- Codeforces #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
- Codeforces Round #246 (Div. 2) A. Choosing Teams
- codeforces——432A—— Choosing Teams
- Teams
- Choosing innodb_buffer_pool_size
- Choosing number
- Thinkphp 登陆退出
- Thinkphp所有页面检测session
- Thinkphp 自动验证
- Unity3d 中的 A*寻路
- Thinkphp的三大自动
- Choosing Teams
- PHP连接sqlserver配置
- 检测页面是否合法链接过来
- php 数组遍历
- PHP上传最大限制的注意事项
- thinkphp setField 更新某字段的值
- mysql 账户管理
- thinkphp add update Delete操作
- php 查询字符串在数组中出现的次数