PAT(Advanced Level)1017——Queueing at Bank
摘要:1017 Queueing at Bank (25 分) Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting a
阅读全文
PAT(Advanced Level)1016——Phone Bills
摘要:1016 Phone Bills (25 分) A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain am
阅读全文
PAT(Advanced Level)1014——The Best Rank
摘要:1014 Waiting in Line (30 分) Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting ar
阅读全文
PAT(Advanced Level)1013——Battle Over Cities
摘要:1013 Battle Over Cities (25 分) It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all
阅读全文
PAT(Advanced Level)1012——The Best Rank
摘要:1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Pro
阅读全文
线段树入门
摘要:线段树是一种比较复杂的数据结构,可用来对一个数组进行维护(查询,求和,计算等)操作。 1. 线段树的特点 线段树是一种二叉树,它的每个节点,存储的是原始数组内一段区间内的某些信息,这些信息满足(幺)半群的性质。每个节点的左右孩子存储的区间为父节点区间的一半。设父节点是存储[L,R]区间,L,R为左右
阅读全文
Linux常用命令(持续更新...)
摘要:cat:查看一个或多个文件的内容。 ls: 显示指定目录的内容,默认当前目录;-l 显示详细的列表,-F显示文件类型的信息。 cp: 将文件1负责到文件2/将多个文件复制到目录 mv:重命名/移动文件 touch:创建文件 rm: 删除文件 cd:设置当前工作目录 mkdir:创建新目录 rmdir
阅读全文
装饰者模式
摘要:装饰者模式想要解决的是动态地扩展类的功能的问题。学过面向对象的同学都知道,面向对象的三大特性之一,继承,也是在解决类的扩展问题。我们将类共有的属性和操作放在父类里面,然后在子类里定义子类特有的属性和操作。继承使父类和子类之间产生了联系,当创建一个新类的时候,我们不需要从头开始,只需要在父类的基础上再
阅读全文