problemscpp
A collection of my answers to algorithm problems in c++.
| 函数
pat::b::b1041 命名空间参考

1041 考试座位号 更多...

struct  student
 

函数

int main (istream &cin, ostream &cout)
 
 TEST (b1041, case1)
 

详细描述

1041 考试座位号

函数说明

◆ main()

int pat::b::b1041::main ( istream &  cin,
ostream &  cout 
)

在文件 pat.cpp1328 行定义.

1328 {
1329 int n;
1330 cin >> n;
1331 unordered_map<int, student> um;
1332 for(int i = 0; i < n; i++) {
1333 student stu;
1334 cin >> stu.id >> stu.seat1 >> stu.seat2;
1335 um[stu.seat1] = stu;
1336 }
1337 cin >> n;
1338 int seat1;
1339 for(int i = 0; i < n; i++) {
1340 cin >> seat1;
1341 student stu = um[seat1];
1342 cout << stu.id << ' ' << stu.seat2 << endl;
1343 }
1344 return 0;
1345 }
struct acwing::acwing3378::student student

引用了 pat::b::b1041::student::id, pat::b::b1041::student::seat1 , 以及 pat::b::b1041::student::seat2.

被这些函数引用 TEST().

◆ TEST()

pat::b::b1041::TEST ( b1041  ,
case1   
)

在文件 pat_test.cpp627 行定义.

627 {
628 istringstream in("4\n"
629 "3310120150912233 2 4\n"
630 "3310120150912119 4 1\n"
631 "3310120150912126 1 3\n"
632 "3310120150912002 3 2\n"
633 "2\n"
634 "3 4");
635 auto out = ostringstream();
636 main(in, out);
637 const auto ans = out.str();
638 ASSERT_EQ("3310120150912002 2\n"
639 "3310120150912119 1\n",
640 out.str());
641 }
int main(int argc, char **argv)
Definition: main.cpp:5

引用了 main().