for (int j = 0; j < student_count; j++){ string student_name; cin>>student_name; student2course[student_name][course_name] = true; } } for (int i = 0; i < Nstudent; i++){ string student_name; cin>>student_name; cout<<student_name; cout<<" "<<student2course[student_nam...
pat 甲级 A1039 Course List for Student (25分) 题目链接: https://pintia.cn/problem-sets/994805342720868352/problems/994805447855292416 题目大意: 某银行开N个窗口办理业务,在每个窗口前设置一条黄线,记最大排队长度为M,现在有K名顾客需要办理业务,有Q名顾客想要查询办理完自己业务的时间,当N个窗口前存在没...
不用hash映射 就要用unordered_map 而且cin还要改成scanf cout改了更好 #include<vector>#include<iostream>#include<algorithm>#include<unordered_map>#include<set>#includeusingnamespacestd;intmain(){ unordered_map<string, vector<int>>student;intn, m;scanf("%d %d", &n, &m);for(inti =0; i < ...
第5个数据点出现段错误,把原本以map存学生对应ID再映射vector存储该学生所选课程改成vector嵌套在map内,就没有段错误的问题出现,疑似映射过程中指针漂移??? AAAAAccepted code: 1#defineHAVE_STRUCT_TIMESPEC2#include<bits/stdc++.h>3usingnamespacestd;4unordered_map<string,vector<int> >name;5strings;6intmain...
PAT 1039. Course List for Student (25) 哈希表,空间换时间,字符串处理时间,/***题意:给出每种课的上课学生名单问学生们分别上了哪些课。/***求解思路和注意点:这题可用哈希也可用map,但是由于数量很大,会超时。当发现
读取数据时候就将课程编号加入所有选择该课的学生的vector即course[i]中,最后输出过程:每次for循环先sort排序该学生的选课vector,最后再从小到大输出该学生的选课编号。 (1)学生通过姓名的方式给出; ——如果用STL的map实现姓名与学生编号的映射,最后一组数据过大,导致用map和string会超时,即类似...
PAT (Advanced Level) Practice 1039 Course List for Student &n...查看原文PAT-A1039 Course List for Student 题目内容及题解 Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course ...
{//n个查询cin>>name;//学生姓名intid=getid(name);//获得学生编号sort(selectcourse[id].begin(),selectcourse[id].end());//从小到大排序printf("%s %d",name,selectcourse[id].size());//姓名,选课数for(intj=0;j
#include<bits/stdc++.h>using namespace std;intmain(){intN,K;scanf("%d %d",&N,&K);inti,Ni;vector<string>s[K+1];stringstr;intcou[N]={0};//每个人上课数量vector<int>course[11];//每个人对应的课程for(intk=0;k<K;k++){scanf("%d %d",&i,&Ni);getchar();//有一个回车...fo...
We just trained the Transformer for 40 epochs. Of course, we need to be careful with just claiming state-of-the-art results on time series with neural networks, as it seems "XGBoost is typically all you need". We are just very curious to see how far neural networks can br...