Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
34196 | 郑涵依 | 朋友信息 | C++ | Accepted | 1 MS | 768 KB | 610 | 2022-08-02 10:26:08 |
#include <iostream> #include <algorithm> #include <string> using namespace std; struct Friend { string name, shengri, dianhua; }p[15]; bool cmp(Friend a, Friend b) { if (a.shengri != b.shengri) return a.shengri < b.shengri; if (a.name != b.name) return a.name < b.name; return a.dianhua < b.dianhua; } int main() { int n; cin >> n; for (int i = 1; i <= n; i ++) { cin >> p[i].name >> p[i].shengri >> p[i].dianhua; } sort(p + 1, p + 1 + n, cmp); for (int i = 1; i <= n; i ++) { cout << p[i].name << " " << p[i].shengri << " " << p[i].dianhua << endl; } return 0; }