提交时间:2024-05-07 15:15:59
运行 ID: 46901
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> nums(n); for (int i = 0; i < n; i++) { cin >> nums[i]; } sort(nums.begin(), nums.end()); for (int i = 0; i < n; i++) { if (nums[i] % 2 == 1) { cout << nums[i] << " "; } } return 0; }