| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 41290 | Songgr | 整数奇偶排序 | C++ | Accepted | 1 MS | 244 KB | 418 | 2024-02-20 11:30:28 |
#include<bits/stdc++.h> using namespace std; bool cmp(int a,int b){ return a>b; } int main() { int n,a[10],b[10],cnt1=0,cnt2=0; for(int i=0;i<10;i++){ cin>>n; if(n%2==1){ a[cnt1++]=n; } else if(n%2==0){ b[cnt2++]=n; } } sort(a,a+cnt1,cmp); sort(b,b+cnt2); for(int i=0;i<cnt1;i++){ cout<<a[i]<<" "; } for(int i=0;i<cnt2;i++){ cout<<b[i]<<" "; } return 0; }