前序工作(宏定义,typedef,函数等)

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <vector>
 4 #include <iostream>
 5 #include <algorithm>
 6 #include <set>
 7 #include <map>
 8 #include <queue>
 9 #include <cmath>
10 
11 #define _for(i,a,b) for(int i = (a);i < (b);i ++)
12 #define _rep(i,a,b) for(int i = (a);i <= (b);i ++)
13 #define push_back pb
14 typedef long long int ll;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
15 
16 using namespace std;
17 
18 struct cmp
19 {
20     inline bool operator() (const int a,const int b)
21     {
22         return a >= b;
23     }
24 };
25 
26 int readint() {int x;scanf("%d",&x);return x;}//vector<int> v;v_push_back(readint())
27 
28 template<typename T>
29 ostream& operator <<(ostream& os,vector<T> &v) {_for(i,0,v.size()) os << v[i] << " "; os << endl;return os;}
30 template<typename T>
31 ostream& operator <<(ostream& os,set<T> &v) {for(auto it = v.begin();it != v.end();it ++) os << *it << " ";os << endl;return os;}
32 int main()
33 {
34     vector<int> v {2,5,2,6,3,3,8,3,7,92,6,323,39,234,32,454,0};
35     sort(v.begin(),v.end(),cmp());
36     
37     _for(i,0,v.size())
38         cout << v[i] << " ";
39     cout << endl;
40     
41     cout << v;
42     return 0;
43 }

 

posted @ 2018-09-30 13:46  Asurudo  阅读(275)  评论(0编辑  收藏  举报