Codeforces Round #246 (Div. 2)(A)模拟
来源:互联网 发布:js 延迟1s 编辑:程序博客网 时间:2024/06/05 22:52
题意:有n个人,接下来给出n个数字,每个数字代表每个人参赛的次数,现在要求组队(每队3人),要求队伍至少要可以参加k次,每个人最多可以参加5次比赛,问最多可以组多少支队伍?
题解:5-a[i]>=k就符合题意num++,最后输出num/3
#include <set> #include <map> #include <list> #include <cmath> #include <queue> #include <vector> #include <cstdio> #include <string> #include <cstring> #include <iomanip> #include <iostream> #include <sstream> #include <algorithm> #define LL long long using namespace std; #define N 200000 #define inf 0x3f3f3f3fchar s[N];int main() { #ifdef CDZSC freopen("i.txt","r",stdin); #endif int n,k;int ans,num=0;scanf("%d%d",&n,&k);for(int i=0;i<n;i++){scanf("%d",&ans);if((5-ans)-k>=0)num++;}printf("%d\n",num/3);return 0;}
0 0
- Codeforces Round #246 (Div. 2)(A)模拟
- Codeforces Round #346 (Div. 2) -A. Round House(模拟)
- Codeforces Round #297 (Div. 2) A(模拟)
- Codeforces Round #340 (Div. 2)(A) 模拟
- Codeforces Round #107 (Div. 2) A(简单模拟)
- Codeforces Round #109 (Div. 2) A (简单模拟)
- Codeforces Round #281 (Div. 2)A(构造+暴力模拟)
- Codeforces Round #328 (Div. 2)Problem A. PawnChess(模拟)
- Codeforces Round #335 (Div. 2) (A)模拟
- Codeforces Round #341 (Div. 2)(A)模拟
- Codeforces Round #294 (Div. 2)(A)模拟
- Codeforces Round #247 (Div. 2)(A)模拟
- Codeforces Round #321 (Div. 2)(A)模拟
- Codeforces Round #273 (Div. 2)(A)模拟
- Codeforces Round #345 (Div. 2)-A. Joysticks(模拟)
- Codeforces Round #277 (Div. 2)(A)模拟,打表
- Codeforces Round #346 (Div. 2)(A)模拟
- Codeforces Round #349 (Div. 2)(A)模拟
- Codeforces 626C Block Towers 【二分】
- Codeforces 626D Jerry's Protest 【概率】
- 弗洛伊德算法求最短路径
- Codeforces 626E Simple Skewness 【二分】
- android 自带图库
- Codeforces Round #246 (Div. 2)(A)模拟
- 观察者模式及Java实现例子
- spring事务传播属性和隔离级别
- 数据结构--单链表
- Xamarin.Android 如何使用圆形Image
- usaco 1.2 complete search
- spring(JDBC)事务配置
- Android 任务栈、Intent.FlAG_ACTIVITY_xxx、Activity四种启动模式
- SpringBoot定时任务说明