题解 | #整数奇偶排序#
整数奇偶排序
https://www.nowcoder.com/practice/bbbbf26601b6402c9abfa88de5833163
#include <bits/stdc++.h> using namespace std; int main() { vector<int>odd,even; int n; while(cin>>n){ if(n%2==1)odd.push_back(n); else even.push_back(n); } sort(odd.rbegin(),odd.rend()); sort(even.begin(),even.end()); for(auto a:odd)cout<<a<<" "; for(auto a:even)cout<<a<<" "; } // 64 位输出请用 printf("%lld")