P1271
  • 板块灌水区
  • 楼主zuohanyi114514
  • 当前回复14
  • 已保存回复14
  • 发布时间2024/6/17 21:57
  • 上次更新2024/6/18 13:30:51
查看原帖
P1271
1278117
zuohanyi114514楼主2024/6/17 21:57

求调

#include<bits/stdc++.h>
using namespace std;
const int N=1000;
int a[N];
int n,m;
int b[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>b[i];
		a[b[i]]++;
	}
	sort(b+1,b+m+1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=a[i];j++){
			cout<<b[i]<<' ';
		}
	}
	return 0;
}
2024/6/17 21:57
加载中...