当前位置:网站首页>[51nod p3058] Xiao ming'ai set [set]

[51nod p3058] Xiao ming'ai set [set]

2022-06-13 09:35:00 Ayane.

 Insert picture description here
 Insert picture description here
l i n k link link

analysis :

Similarity degree = = = Same number of elements / / / Total elements use s e t set set You can find the number of different elements

CODE:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
#define reg register
using namespace std;
typedef long long ll;
int T,n,m;
set<int> a;
int main(){
    
	scanf("%d",&T);
	while(T--)
	{
    
		a.clear();
		scanf("%d%d",&n,&m);
		for(reg int i=1,x;i<=n+m;i++)
		{
    
			scanf("%d",&x);
			a.insert(x);
		}
		int len=a.size();
		printf("%d\n",(n+m-len)*100/len);
	}
	return 0;
}
原网站

版权声明
本文为[Ayane.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270530324701.html