3 条题解

  • 0
    @ 2024-3-10 16:05:51
    using namespace std;
    struct zb
    {
    	string name;
    	int nian;
    	int yue;
    	int ri;
    	int id;
    }g[101];
    bool paixu(zb a, zb b)
    {
    	if (a.nian < b.nian)return 1;
    	else if (a.nian == b.nian) {
    		if (a.yue < b.yue)return 1;
    		else if (a.yue==b.yue){
    			if (a.ri < b.ri)return 1;
    			else if (a.ri == b.ri) {
    				if (a.id > b.id)return 1;
    			}
    		}
    	}
    	return 0;
    }
    int  main() {
    	int n;
    	cin >> n;
    	for (int i = 1; i <= n; i++) {
    		cin >> g[i].name >> g[i].nian >> g[i].yue >> g[i].ri;
    		g[i].id = i;
    	}
    	sort(g + 1, g + 1 + n, paixu);
    	for (int i = 1; i <= n; i++) {
    		cout << g[i].name<<endl;
    	}
    	return 0;
    }
    

    信息

    ID
    718
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    106
    已通过
    22
    上传者