Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
36406 | Jeremy | 奇数单增序列 | C++ | Accepted | 0 MS | 248 KB | 398 | 2024-01-13 13:41:52 |
#include<bits/stdc++.h> using namespace std; int n,a[510]={}; bool cmp(int a,int b){ return a<b; } int main() { int cnt=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a+1,a+n+1,cmp); int flag=0; for(int i=0;i<n;i++){ if(flag==0&&a[i]%2==1){ cout<<a[i]; flag=1; } else if(a[i]%2==1){ cout<<","<<a[i]; } } return 0; }