Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
41334 liusiyu 奇数单增序列 C++ 通过 0 MS 240 KB 379 2024-02-20 12:24:16

Tests(1/1):


#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; }


测评信息: