1 solutions
-
0
Guest MOD
-
1
struct的重载运算符
学而时习之,不亦说乎------《论语》
重载运算符:[C++ 重载运算符和重载函数 | 菜鸟教程 (runoob.com)](https://)
简称:又快捷又实用
代码(code):
#include<bits/stdc++.h> typedef long long ll; using namespace std; const int N=10010; int n; struct asd{ int a; int b; int c; bool operator<(const asd&other)const{//QWQ if(a==other.a){ if(b==other.b){ return c<other.c; } else return b>other.b; } else return a<other.a; } }; asd s[N]; int main(){ cin.sync_with_stdio(false); ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>s[i].a>>s[i].b>>s[i].c; } sort(s+1,s+1+n); for(int i=1;i<=n;i++){ cout<<s[i].a<<' '<<s[i].b<<' '<<s[i].c<<'\n'; } return 0; }点个赞吧qwq
Information
- ID
- 730
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- (None)
- # Submissions
- 94
- Accepted
- 16
- Uploaded By