提交时间:2024-02-20 12:24:16

运行 ID: 41334

#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[n],h[n],p=0; for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]%2!=0){ h[p]=a[i]; p++; } } for(int i=0;i<p;i++){ for(int j=i+1;j<p;j++){ if(h[i]>h[j]) swap(h[i],h[j]); } } for(int i=0;i<p;i++){ if(i==p-1) cout<<h[i]; else cout<<h[i]<<","; } return 0; }