题解 | 小红的不动点分配

小红的不动点分配

https://www.nowcoder.com/practice/9af88720190248d5a8dc3cebdf050b21

#include<bits/stdc++.h>
using namespace std;




int main(){
	int n;  cin >> n;
	
	map<int,int> mp;
	
	for(int i=1 ; i <= 2*n ; i++){
		int a;  cin >> a;
		
		mp[a]++;
	}
	
	int ans = 0;
	for(auto it:mp){
		if(it.first <= n)
		ans += min(it.second,2);
	}
	
	cout << ans;
	
	return 0;
}

全部评论

相关推荐

MrGaomq:你沟通的太少了,我两个号沟通了都1w多了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务