题解
2023-08-12 09:06:58
发布于:浙江
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct student{ //结构体定义
string name ,jnum ,dnum;
};
int main(){
int n;
cin >> n;
student s[n + 1] = {};
for(int i = 1 ; i <= 3 * n ; i++){
string c;
int a ,b;
cin >> a >> b >> c; //输入
if(b == 2)
s[a].name = c;
else if(b == 3)
s[a].jnum = c;
else if(b == 4)
s[a].dnum = c;
}
for(int i = 1 ; i <= n ; i++) //遍历输出
cout << i << " "<< s[i].name << " " << s[i].jnum << " " << s[i].dnum << "\n";
return 0;
}
这里空空如也
有帮助,赞一个