社区讨论
被图论虐到爆炸
P1059[NOIP 2006 普及组] 明明的随机数参与者 6已保存回复 9
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 8 条
- 当前快照
- 1 份
- 快照标识符
- @m676o9m8
- 此快照首次捕获于
- 2025/01/22 08:46 去年
- 此快照最后确认于
- 2025/01/22 09:37 去年
学提高学的累死个人,切个水题开心一下
CPP#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;
}
回复
共 9 条回复,欢迎继续交流。
正在加载回复...