提交时间:2024-05-07 15:20:25
运行 ID: 46902
#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()); int flag = 0; for (int i = 0; i < n; i++) { if (nums[i] % 2 == 1) { if(flag == 1) cout << ","; cout << nums[i]; flag = 1; } } return 0; }