中山大学_预推免_机试

机试流程与内容

流程

晚上 6.30 到 9.30 模拟机试,机试题目是 此次夏令营 的真题。
第二天 早上 9.00 到 12.00 正式机试

内容

时长: 三个小时
题量: 十道题,每题满分 100 分,按通过样例给分。(优先做会做的
语言: C 或 C++
编程环境: 代码提交有 中山大学 提供的 OJ,但是越到后期提交队列越长,wait 和 judge 的时间也越长
本地提供 ide,可以先使用本地 ide 写好代码之后复制粘贴到 OJ

下面是记得的机试题目,凭印象给出,题目大意正确,但细节可能有误差

1.LRU 缓存队列

2.实现 instanceof

根据 实例 返回该实例的 类名

#include <iostream>
#include <string>
using namespcae std;
class Object {
	public:
	string instance;
	Object() {
		instance = "Object";
	}
};

class Student: public Object {
	public:
	Student() {
		instance = "Student";
	}
};

string instanceof(Object &obj) {
	return obj.instance;
}

int main() {
	Student student;
	cout << instanceof(student) << endl; // Student
	return 0;
}

3.环形链表

给定链表,判断有无环,并且返回环的第一个节点

4.图检测有无环

拓扑排序检测有没有环

5.分割序列

给定 a,b 两个序列,其中 a1 < b1,a2 < b2,…,an < bn
现需要得出序列 c,其中 a1 <= c1 <= b1,a2 <= c2 <= b2,…,an <= cn <= bn,并且 c1 < c2 < … < cn
求序列 c 的个数,没有则为0

6.打印字符日志

给出一段日志内容,从左到右打印出来。其中仅包含英文字母和字符 “[” 和 “]”,“[” 表示光标移动到最左边开始打印,"]" 表示光标移动到最右边开始打印日志,现需要打印出最终的英文字母序列。

发布了51 篇原创文章 · 获赞 27 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_39446719/article/details/101763662