【Codeforces Round #452 (Div. 2) A】 Splitting in Teams
in Codeforces div round Teams
2023-09-14 09:03:45 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
贪心 1优先和2组队。 如果1没有了 就结束。 如果1还有多余的。 那么就自己3个3个组队【代码】
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n;
int a[3];
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
for (int i = 1;i <= n;i++){
int x;
cin >> x;
a[x]++;
}
int ans = min(a[1],a[2]);
a[1]-=ans;
ans+=a[1]/3;
cout << ans << endl;
return 0;
}
相关文章
- ORA-01256: error in locking database file string ORACLE 报错 故障修复 远程处理
- ORA-46107: Privilege string not found in the associated security classes ORACLE 报错 故障修复 远程处理
- ORA-01090: shutdown in progress – connection is not permitted ORACLE 报错 故障修复 远程处理
- ORA-01719: outer join operator (+) not allowed in operand of OR or IN ORACLE 报错 故障修复 远程处理
- 进行字符串比较使用Oracle IN运算符比较字符串(oracle使用in)
- MySQL查询优化:从IN中获取更高性能(mysql查询优化in)
- 运算MySQL无法使用IN操作(mysql不能用in)
- MySQL中IN查询的使用方法(mysql查询in)
- 语句SQL Server中使用IN语句处理多值查询(sqlserver中in)
- 如何在MySQL中代替IN关键字(mysql中代替in)
- MySQL中使用IN函数的查询限制是什么(mysql中in的限制)
- MySQL中使用IN操作符查询字符串(mysql中in字符串)
- MYSQL中IN关键字如何高效处理大量数据(mysql中in关键字)
- 探索ORACLE中IN关键字的使用(in怎么使用oracle)
- MySQL如何使用IN查询语句(mysql不能用in吗)
- MySQL不支持IN运算符如何解决(mysql 不支持in)
- 符号Oracle 中与 IN 的区别(Oracle中=和in)
- Oracle数据库中的IN关键字深度剖析(oracle中in的详解)
- 从Oracle到NO IN数据库迁移指南(oracle no in)
- in用Oracle中Like和In实现模糊查询(oracle like和)