被图论虐到爆炸
查看原帖
被图论虐到爆炸
1133351
JNFLS_zhangruihang楼主2025/1/22 08:46

学提高学的累死个人,切个水题开心一下

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

int st[105],top;
int main()
{
	int n,x,temp;
	priority_queue<int> q;
	cin>>n;
	temp=n;
	while(n--)
	{
		cin>>x;
		q.push(x);
	}
	while(!q.empty())
	{
		int y=q.top();
		q.pop();
		if(y!=st[top])st[++top]=y;
		else temp--;
	}
	cout<<temp<<endl;
	while(top)
	{
		cout<<st[top--]<<" ";
	}
	return 0;
}
2025/1/22 08:46
加载中...