首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
emoji
2025年3月18日 19:38
查找学生信息2 题解:
P1476
回复 0
|
赞 9
|
浏览 807
初次使用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
|
赞 1
|
浏览 692
#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
|
赞 3
|
浏览 740
#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
|
浏览 461
有无大佬帮忙看看,本地没问题,为什么提交的时候,一会过了,一会没过啊? #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
|
赞 18
|
浏览 750
在本题中,学号可能包含前导零(例如输入样例中的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
|
浏览 658
#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
|
赞 11
|
浏览 1.8k
//方法一:结构体 #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
|
浏览 927
#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...
zx142407789
2024年3月20日 18:14
查找学生信息2 题解:运行超时通过率33%
P1476
回复 2
|
赞 7
|
浏览 1.1k
#include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct { char number[5]; char name[50]; char sex[50]; int age; }student; void search(student *list,int n, char* s) { for (int i = 0; i < n; i++) { if (strcmp(list[i].number, s) == 0) { p...
15240928957
2024年3月16日 12:47
查找学生信息2 题解:只对了33%,求教
P1476
回复 5
|
赞 5
|
浏览 1.3k
#include <iostream> #include <map> #include <string.h> using namespace std; struct student { char id[10], name[10], sex[10],age[10]; }; student stu[1000]; map<string, student>m; int main() { int n; &...
1
2
题目
查找学生信息2
题解数量
20
发布题解
在线答疑
热门题解
1
查找学生信息2 题解:解释id只能用string类型的原因(超清晰,丁真看了都要抽一根瑞克五代)
2
需要注意!有中英文的区别不然只有33.3%通过率
3
查找学生信息2 题解:
4
查找学生信息2 题解:正确率只有33%,id不要用int类型改用string过了。我也不知道为什么。
5
查找学生信息2 题解:运行超时通过率33%
6
查找学生信息2 题解:只对了33%,求教
7
查找学生信息2 题解:c
8
查找学生信息2(结构体数组) 题解:
9
查找学生信息2 题解:map的基本用法
10
查找学生信息2 题解: