哈哈哈哈哈哈哈哈

tangruihan 2019-12-22 14:02:06 13

#include <bits/stdc++.h> using namespace std; struct px{ string name; int cj; }s[20]; bool cmp(px a,px b){ if(a.cj==b.cj){ return a.name<b.name; } return a.cj>b.cj; } int main(){ freopen("B.in","r",stdin); freopen("B.out","w",stdout); int n; cin>>n; for (int i = 1; i <= n; i++) { cin >> s[i].name >> s[i].cj; }
sort(s + 1, s + 1 + n, cmp);
for(int i=1;i<=n;i++){ cout<<i<<" "<<s[i].name<<" "<<s[i].cj<<endl; } return 0; }

{{ vote && vote.total.up }}

共 2 条回复

zongyubo

giaogiao

zongyubo

giaogiao