社区讨论
求条(玄关)
AT_dwango2017qual_cスキーリフトの相乗り参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mj0656cd
- 此快照首次捕获于
- 2025/12/10 23:33 2 个月前
- 此快照最后确认于
- 2025/12/10 23:40 2 个月前

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
const int N=1e8+10;
int n,sum;//sum用来统计发了几次车
int a[N];
int t[N];//桶
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> n;
for(int i=1;i<=n;i++){
cin>>a[i];//每一个小组的人数
t[a[i]]++;//每一种人数有几个
}
for(int i=1;i<=n;i++){
if(a[i]<4){
if(t[4-a[i]]!=0){
t[4-a[i]]--;
t[a[i]]--;
sum++;
}
}
else if(a[i]==4){
sum++;
t[a[i]]--;
}
}
cout<<sum<<endl;
return 0;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...