首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
xsw
2026年2月2日 09:20
查找学生信息2 题解:
P1476
回复 0
|
赞 4
|
浏览 289
#include<iostream> using namespace std; struct Student { string id; string name; string sex; int age; }s[1010]; int main() { int n; cin >> n; for (int i = 0; i < n; i ++ ) cin >> s[i].id >> s[i].name >> s[i].sex >> s[i].age; in...
mlx
2026年1月26日 20:31
查找学生信息2 题解:
P1476
回复 0
|
赞 5
|
浏览 274
#include<iostream> #include<map> using namespace std; struct node{ string name; string gender; int age; }; map<string,node> a; int n,m; int main() { cin>>n; for(int i=1;i<=n;i++) { string id; node p; cin>...
emoji
2025年3月18日 19:38
查找学生信息2 题解:
P1476
回复 0
|
赞 14
|
浏览 1.6k
初次使用map,真滴好用!!! #include<iostream> #include<map> #include<string> #include<iomanip> using namespace std; struct stu{ string id;//尽量用string,因为用int只有66%的正确率。 string name; string a; int age; }; void put(stu a){ cout<<a.id<<' '<<a.name...
cc12345
2025年3月18日 00:30
查找学生信息2 题解:使用flag来判断是否存在;记住类型用strin
P1476
回复 0
|
赞 2
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; struct student{ string number; string name; string sex; string age; }; int main() { int n; cin>>n; vector <student> a(n); for(int i=0;i<n;i++) { cin>>a[i].number>>a[i].name>>a[i].sex>>a[i]....
carrot_huan
2025年3月13日 16:01
查找学生信息2 题解:map的基本用法
P1476
回复 0
|
赞 8
|
浏览 1.6k
#include<iostream> #include<map> #include<string> using namespace std; struct Info { string name; string sex; int year; }; int main() { map<string, Info> data; int n...
戴戴砺山河
2025年2月28日 17:07
查找学生信息2 题解:
P1476
回复 0
|
赞 3
|
浏览 1.0k
有无大佬帮忙看看,本地没问题,为什么提交的时候,一会过了,一会没过啊? #include <sstream> #include <iostream> #include <unordered_map> using namespace std; unordered_map<string, string> stu; int main() { int n, m; cin >> n; getchar(); while (n -- ) { ...
西电机试专家
2025年2月9日 12:23
查找学生信息2 题解:解释id只能用string类型的原因(超清晰,丁
P1476
回复 0
|
赞 26
|
浏览 1.6k
在本题中,学号可能包含前导零(例如输入样例中的01,02)。如果使用int类型存储学号,这些前导零会被自动去除,导致以下问题: 学号唯一性被破坏 例如,学号01和001用int存储时都会变成1。这会导致不同学号被误认为相同,从而覆盖数据或错误匹配。 输入输出格式不一致 题目要求输出的学号必须与输入一致(如02而非2)。用int类型无法保留前导零,导致输出格式错误。 #include <bits/stdc++.h> using namespace std; struct student{//类型 st...
Nyakahashi
2025年1月25日 17:54
查找学生信息2 题解:正确率只有33%,id不要用int类型改用str
P1476
回复 1
|
赞 8
|
浏览 1.2k
#include using namespace std; typedef struct Student{ string id; string name; string sex; string score; }Student; int main(){ Student stu; int n,m; map mp; cin >>n; for(int i = 0; i< n;i++){ cin>>stu.id>>stu.name>...
可可爱爱草莓派
2024年8月30日 10:01
需要注意!有中英文的区别不然只有33.3%通过率
P1476
回复 0
|
赞 15
|
浏览 2.6k
//方法一:结构体 #include<bits/stdc++.h> using namespace std; struct Node { string name; string sex; int age; } node; int main() { int n,m; while(cin >> n) { map&...
Candour
2024年5月5日 23:56
查找学生信息2(结构体数组) 题解:
P1476
回复 0
|
赞 3
|
浏览 1.3k
#include <bits/stdc++.h> using namespace std; const int N = 1010; int n, m; struct student{ string id; string name; string gender; int age; }s[N]; int main() { cin >> n; for(int i = 1; i <= n; i ++) cin >> s[i].id >> s[i].name >&g...
1
2
3
4
题目
查找学生信息2
题解数量
32
发布题解
在线答疑
热门题解
1
查找学生信息2 题解:解释id只能用string类型的原因(超清晰,丁真看了都要抽一根瑞克五代)
2
需要注意!有中英文的区别不然只有33.3%通过率
3
查找学生信息2 题解:
4
查找学生信息2 题解:运行超时通过率33%
5
查找学生信息2 题解:正确率只有33%,id不要用int类型改用string过了。我也不知道为什么。
6
查找学生信息2 题解:map的基本用法
7
查找学生信息2 题解:c
8
查找学生信息2 题解:
9
查找学生信息2 题解:只对了33%,求教
10
查找学生信息2 题解: