Codeforces Round #823 (Div. 2) 补题题解 (A、B、C)

Codeforces Round #823 Div. 2

    • A Planets (800)
    • B Meeting on the Line (1600)
    • C Minimum Notation (1200)


A Planets (800)

简单模拟,看见这个数据范围就是放手模拟

#include

using namespace std;

const int N = 110;

int T;
int c, n, a[N];
map<int, int>mp;
int p[N];

void solve(){
   
	cin>>n>>c;
	int ans = n;
	int res = 0;
	mp.clear();
	
	for(int i = 1; i <= n; i ++ ){
   
		cin>>a[i];
		if(!mp[a[i]]){
     //如果这个数没有出现过 
			p[ ++ res] = a[i];
		}
		mp[a[i]] ++ ;
	}
	
	for(int i = 1; i <= res; i ++ ){
   
		if(mp[p[i]] >= c

你可能感兴趣的:(比赛,c语言,c++,算法)