2 条题解

  • 0
    @ 2025-7-18 14:02:24

    装个逼

    1.vector

    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    #define endl '\n'
    int main(){
    	ios::sync_with_stdio(false);
    	cin.tie(nullptr);cout.tie(nullptr);
    	vector<int>a(5);
    	for(int i=0;i<=4;i++)cin>>a[i];
    	sort(a.begin(),a.end());
    	for(int i=4;i>=0;i--)cout<<a[i]<<" ";
    	return 0;
    }
    

    2.@杨隽芮如果不反序输出那么这个送给你

    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    #define endl '\n'
    int main(){
    	ios::sync_with_stdio(false);
    	cin.tie(nullptr);cout.tie(nullptr);
    	vector<int>a(5);
    	for(int i=0;i<=4;i++)cin>>a[i];
    	sort(a.begin(),a.end(),greater<int>());
    	for(int i=0;i<=4;i++)cout<<a[i]<<" ";
    	return 0;
    }
    

    3.杨隽芮:一定要用函数

    马睿:行

    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    typedef long long LL;
    #define endl '\n'
    int main(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);cout.tie(nullptr);
      vector<int>a(5);
      for(int i=0;i<=4;i++)cin>>a[i];
      sort(a.begin(),a.end(),[&](const int& x,const int& y){
      	return x>y;
      });
      for(int i=0;i<=4;i++)cout<<a[i]<<" ";
      return 0;
    }
    

    看得方便多了

    信息

    ID
    1500
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    128
    已通过
    69
    上传者