文章
25
粉丝
82
获赞
480
访问
33.4k
- //07/09/24 21:15
- //07/09/24 21:27
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
-
- int arr[9];
- vector<int> arr1,arr2;
-
- bool cmpDec(int a,int b){
- return a>b;
- }
-
- int main(){
- int n = 10;
- int num;
- for(int i = 0; i < n; i++){
- cin>>num;
- if(num%2 == 1) arr1.push_back(num);
- else arr2.push_back(num);
- }
- sort(arr1.begin(),arr1.end(),cmpDec);
- sort(arr2.begin(),arr2.end());
- for(auto i: arr1) cout<<i<<' ';
- for(auto i: arr2) cout<<i<<' ';
-
- return 0;
- }
登录后发布评论
暂无评论,来抢沙发