2 条题解

  • 2
    @ 2024-12-6 16:47:57
    #include<bits/stdc++.h>
    using namespace std;
    struct niuma{
    	char name[20];
    	int score;
    };
    int main()
    {
    	niuma stu[1000];
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>stu[i].name;
    		cin>>stu[i].score;
    	}
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=n-1;j++)
    		{
    			if(stu[j].score<stu[j+1].score)
    			swap(stu[j],stu[j+1]);
    		}
    	}
    	for(int i=1;i<=n;i++)
    	{
    		cout<<stu[i].name<<" ";
    		cout<<stu[i].score<<endl;
    	}
    	return 0;
    }
    
    • @ 2024-12-6 16:48:29

      五瓦主播我是你粉丝啊

    • @ 2024-12-7 13:22:19

      牛啊主播

  • 0
    @ 2024-12-6 17:48:56

    #include<bits/stdc++.h> using namespace std; struct student { char name[10000]; int fen; }; int main() { student st[10000]; int n,i; cin>>n; for(int i=1;i<=n;i++) { cin>>st[i].name; cin>>st[i].fen; } for(int i=1;i<=n;i++) { for(int j=1;j<=n-1;j++) { if(st[j].fen<st[j+1].fen) { swap(st[j],st[j+1]); } } } for(int i=1;i<=0;i++) { cout<<st[i].name<<" "<<st[i].fen<<" "; } return 0; }

    • 1

    信息

    ID
    214
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    48
    已通过
    15
    上传者