8 条题解

  • 1
    @ 2026-4-25 10:51:22
    ......
    struct r{
    	int t,nl;
    }a[10010];
    bool cmp(r p,r q){
    	if(p.nl>=60&&q.nl>=60){
    		if(p.nl!=q.nl){
    			return p.nl>q.nl;
    		}else{
    			return p.t<q.t;
    		}
    	}
    	else if(p.nl<60&&q.nl<60){
    		return p.t<q.t;
    	}else{
    		return p.nl>q.nl;
    	}
    }
    int main(){
    	......
    	sort(a,a+n,cmp);
    	for(int i=0;i<n;i++){
    		......
    	}
    } 
    
    • 0
      @ 2026-5-18 16:08:49

      #include <bits/stdc++.h>

      using namespace std;

      int main() {

      int n;
      
      cin >> n;
      
      vector<int> v;
      
      for (int i = 0; i < n;i++)
      {
      
          int x;
          
          cin >> x;
          
          v.push_back(x);
          
      }
      
      for(int i=0;i<v.size();++i)
      {
      
          cout <<v[i] << " ";
          
      }
      
      return 0;
      

      }

      • 0
        @ 2026-4-25 11:12:06

        \prod

        • 0
          @ 2026-4-25 11:05:39
          #include <bits/stdc++.h>
          using namespace std;
          struct br{
          	string xh;
          	int id, nl;
          }a[__];
          bool cmp(br p, br q) {
          	if(p.nl >= __ && q.nl >= __) {
          		if(p.nl != q.nl) return p.nl > q.nl;
          		else return p.id < q.id;
          	} 
          	else if(p.nl < __ && q.nl < __) return p.id < q.id;
          	else return p.nl > q.nl;
          }
          int n;
          int main() {
          	cin >> n;
          	for(int i = 1; i <= n; i++) {
          		cin >> a[_].xh >> a[_].nl;
          		a[_].id = i;
          	}
          	sort(a+1, a+n+1, cmp);
          	for(int i = 1; i <= n; i++) {
          		cout << a[_].xh << endl;
          	}
          	return 0;
          }
          • 0
            @ 2026-4-25 11:03:57

            请输入文本

            • 0
              @ 2026-4-25 11:03:56

              #include <bits/stdc++.h> using namespace std; struct br{ string xh; int id, nl; }a[__]; bool cmp(br p, br q) { if(p.nl >= __ && q.nl >= __) { if(p.nl != q.nl) return p.nl > q.nl; else return p.id < q.id; } else if(p.nl < __ && q.nl < __) return p.id < q.id; else return p.nl > q.nl; } int n; int main() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[].xh >> a[].nl; a[].id = i; } sort(a+1, a+n+1, cmp); for(int i = 1; i <= n; i++) { cout << a[].xh << endl; } return 0; }

              • 0
                @ 2026-4-25 11:03:20

                病人排队答案

                • 0
                  @ 2026-4-25 11:02:25

                  bool cmp(br x,br y){ if(x.age>=60&&y.age>=60){ if(x.age!=y.age){ return x.age>y.age; }else{ return x.t<y.t; } }else if(x.age<=60&&y.age<=60){ return x.t<y.t; }else{ return x.age>y.age; } }

                  int main(){ for(int i=1;i<=n;i++){ a[i].t=i; } sort(a+1,a+n+1,cmp); }

                  • 1

                  信息

                  ID
                  2946
                  时间
                  1000ms
                  内存
                  256MiB
                  难度
                  4
                  标签
                  递交数
                  59
                  已通过
                  26
                  上传者