自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lilian的博客

快乐学习!

  • 博客(41)
  • 收藏
  • 关注

原创 PAT A1049:Counting Ones

题目描述1049 Counting Ones (30分)The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N ...

2020-04-27 16:45:19 93

原创 PAT A1046 Shortest Distance

题目描述1046 Shortest Distance (20分)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Spec...

2020-04-27 12:29:45 100

原创 PAT A1043:Is it a Binary Search Tree

题目描述1043 Is It a Binary Search Tree (25分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with ke...

2020-04-27 11:14:14 108

原创 PAT A1020 Tree Traversals之建树和层次遍历

题目描述1020 Tree Traversals (25分)Suppose that all the keys in a binary tree are distinct positive integers.Given the postorder and inorder traversal sequences, you are supposed to output the level ord...

2020-04-26 20:58:14 173

原创 PAT A1019 General Palindromic Number

题目描述1019 General Palindromic Number (20分)A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All s...

2020-04-26 15:32:17 75

原创 PAT A1018:Public Bike Management之最短路径和DFS求解

题目描述1018 Public Bike Management (30分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ...

2020-04-26 14:42:19 176

原创 PAT A1017: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 area into two parts.All the customers have to ...

2020-04-23 17:17:55 172

原创 PAT A1016: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 amount per minute, depending on the time of day ...

2020-04-23 12:37:32 112

原创 PAT A1015:Reversible Primes

题目描述1015 Reversible Primes (20分)A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime.For example in the decimal system 73 is a reversible prime b...

2020-04-21 20:13:13 102

原创 《计算机网络自顶向下》第五章:链路层

链路层一、 链路层概述a) 术语:b) 链路层提供的服务c) 链路层在何处实现二、 差错检测和纠正技术一、 链路层概述数据链路层负责通过一条链路从一个结点向另一个物理链路直接相连的相邻结点传送数据报。a) 术语:i. 在本章中将运行链路层协议的任何设备均称为结点。结点包括主机、路由器、交换机和WIFI接入点。ii. 把沿着通信路径连接相邻结点的通信信道称为链路。iii. 在通过特定的链...

2020-04-21 17:14:22 617

原创 PAT A1014:Waiting in Line

题目描述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 area into two parts. The rules for the customers...

2020-04-21 12:23:36 188

原创 PAT A1013:Battle Over Citis之DFS求解

题目描述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 the highways from/toward that city are closed....

2020-04-16 14:48:15 90

原创 PAT A1070:Mooncake之贪心求解

题目描述1070 Mooncake (25分)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to t...

2020-04-15 20:44:23 186

原创 PAT A1033:To Fill or Not to Fill之贪心求解

题目描述1033 To Fill or Not to Fill (25分)With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on ...

2020-04-15 20:32:24 135

原创 PAT A1025:PAT Ranking

题目描述1025 PAT Ranking (25分)Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several...

2020-04-15 20:19:43 88

原创 PAT A1011:World Cup Betting

题目描述1011 World Cup Betting (20分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the Wo...

2020-04-15 20:09:47 92 1

原创 PAT A1008:Elevator

题目描述1008 Elevator (20分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specif...

2020-04-15 20:06:04 89

原创 PAT A1006:Sign In and Sign Out

题目描述1006 Sign In and Sign Out (25分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the r...

2020-04-15 20:03:54 118

原创 PAT A1005:Spell It Right

题目描述1005 Spell It Right (20分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input fil...

2020-04-15 20:00:57 84

原创 PATA1012: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 Programming Language, M - Mathematics (Calculus o...

2020-04-15 19:22:15 128

原创 PATA1004之BFS求解

问题描述PAT A1004 Counting Leaves (30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file conta...

2020-04-15 11:26:39 128

原创 最短路径问题之Dijkstra算法

问题描述给定结点之间的关系,给定源节点及目标结点,求出从源节点到目标结点的最短路径值且记录该最短路径。算法思想用一个二维数组edge[i][j]表示结点i与结点j之间的距离关系,用一个数组dist[i]表示从源节点到目标结点i的最短路径值,path[i]用于保存原点source到节点i的最短路径上结点i的前一个结点,vis[i]用于标识结点i是否被访问V为结点集合,每次从V-S选取离源节...

2020-04-14 18:59:55 142

原创 PATA1003:Emergency的Dijkstra解法

题目描述1003 Emergency (25分)As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue te...

2020-04-14 16:14:06 134

原创 fill函数与memset函数

fill函数和memset函数都可以给数组赋初始值,但有以下区别:memset函数是按照字节赋值,一般只能给数组赋初始值0或-1,头文件为#include <string.h>或#include <cstring>,使用方法为memset(数组名,初始值,sizeof(数组名))fill函数是按照单元赋值,可以将一个数组中的所有元素赋同一值(可以为任意值),头文件为#...

2020-04-13 19:49:36 428

原创 《三十天自制操作系统》第二天

Makefile入门前言实验主要内容遇到的问题以及解决方法程序设计创新点前言本文仅作记录用,谨慎参考!实验主要内容内容1:寄存器介绍以及汇编代码的入门a) 寄存器介绍b) AT&T汇编指令与Intel汇编指令的区分 Intel代码省略了指示大小的后缀,我们看到的指令是mov,而不是movb/movw/movl; Intel代码省略了寄存器名字前面的’%’符号,用的是A...

2020-04-13 16:55:58 614

原创 PATA1093:count PAT's

问题描述1093 Count PAT’s (25分)The string APPAPT contains two PAT’s as substrings.The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, a...

2020-04-10 16:16:11 193 1

原创 PATA1010:Radix

题目描述Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true?The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive ...

2020-04-10 14:19:14 188

原创 最大子段和问题与动态规划算法的推广

前言摘录自《计算机算法设计与分析》(第三版)最大子矩阵和问题问题描述:给定一个m行n列的整数矩阵A,试求矩阵A的一个子矩阵,使其各元素之和为最大。最大子矩阵和问题是最大子段和问题的二维的推广。用二维数组a[1:m][1:n]表示给定的m行n列的整数矩阵。子数组a[i1:i2][j1:j2]表示左上角和右下角行列坐标分别为(i1,j1)和(i2,j2)的子矩阵,其各元素之和记为s(i1,i2...

2020-04-09 21:24:24 632

原创 PATA1009:Product of Polynomials两种解法

题目描述1009 Product of Polynomials (25分)This time, you are supposed to find A×B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 line...

2020-04-09 18:38:02 127

原创 最大子段和算法详解

问题描述给定由n个整数(可能为负整数)组成的序列a1,a2,…,ana_1,a_2,…,a_na1​,a2​,…,an​,求该序列形如∑k=ijak\sum_{k=i}^j a_k∑k=ij​ak​的子段和的最大值。当所有整数均为负整数时定义其最大子段和为0。依此定义,所求的最优值为max{0,max∑k=ijak(1≤i≤j≤n)}max\{ 0,max \sum_{k=i}^j a_k \...

2020-04-09 12:32:57 7341

原创 PAT A1007:Maximum Subsequence Sum(AC代码)

题目描述A1007 Maximum Subsequence SumGiven a sequence of K integers { N1, N2, …, NK}. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj} where 1≤i≤j≤K. The Maximum Subsequence is the continuou...

2020-04-09 11:36:01 125

原创 PAT A1001:A+B Format(AC代码)

题目描述Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each inpu...

2020-04-07 16:00:07 99

原创 PAT A1002:A+B for Polynomials(AC代码)

题目描述This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the info...

2020-04-07 15:37:31 102

原创 《三十天自制操作系统》第一天

从计算机结构到汇编程序前言实验主要内容遇到的问题及解决方法程序设计创新点前言本文仅用作记录,谨慎参考!实验主要内容内容1:下载文件Bz162文件,双击启动Bz.exe程序;成功启动该程序之后的页面如下内容2:软盘映像文件的制作a)方法一:通过在Bz.exe程序中输入机器码,然后保存即可以生成相应的映像文件helloos.img可以看到,从第0x76个字节到第0x81个字节存储的...

2020-04-05 20:47:49 1081 1

原创 CSAPP:缓存实验

目录前言搭建环境与分析脚本创建与释放缓存任务二跟踪与分析实例转置函数分块编写N32装置分块编写N64和N67转置总结前言本文用于记录之前做实验的一些信息,可能思路有些凌乱,谨慎参考!搭建环境与分析脚本实验valgrind安装先将这个文件拖动到64位的ubuntu系统进行解压(注意:在ubuntu下解压而非在window下解压),将解压后的文件在终端打开,输入./configure ...

2020-04-05 20:20:59 3724

原创 CSAPP:ShellLab实验

目录前言任务一任务二任务三任务四任务五任务六任务七任务八前言本实验是《深入理解计算机系统》一书中的附带实验,也称外壳实验。在本次实验中,学生们实现他们自己的带有作业控制的Unix外壳程序,包括ctrl-c和ctrl-z按键、fg、bg和jobs命令。这是学生们第一次接触并发,并且让他们对Unix的进程控制、信号和信号处理有清晰的了解。本文用于记录之前做实验的一些信息,可能思路有些凌乱,谨慎...

2020-04-05 19:42:44 8756 2

原创 CSAPP:PerfLab实验

目录前言PartA优化一PartA优化二PartA优化三PartB优化一PartB优化二PartB优化三前言本实验是《深入理解计算机系统》一书中的附带实验。在本实验中,学生们必须优化应用程序的核心函数(如卷积积分或矩阵转置)的性能。这个实验非常清晰地表明了高速缓存地特性,并带给学生们低级程序优化的经验。本文用于记录之前做实验的一些信息,可能思路有些凌乱,谨慎参考!常用的几种代码优化的思路:...

2020-04-05 17:30:05 6795 1

原创 CSAPP:BufLab

目录前言实验内容及操作步骤:一、level 0:Candle二、level 1:Sparkler三、level 2:Firecracker四、level 3:Dynamite五、level 4:Nitroglycerin前言掌握缓冲区溢出攻击的原理,加深对IA-32调用约定和堆栈组织的理解,对可执行文件bufb应用一系列缓冲区溢出攻击。仅供参考!实验内容及操作步骤:一、level 0:C...

2020-04-02 20:59:54 2060

原创 CSAPP:DataLab实验

目录前言实验内容及操作步骤操作步骤一、安装dlc二、阅读引导以及注意事项【datalab-handout下的bits.c文件中的引导以及注意事项】三、函数实现实验结果及分析前言学生实现简单的逻辑,二进制补码和浮点函数,但使用C的高度受限的子集。例如,可能会要求他们仅使用位级操作和直线代码来计算数字的绝对值。本实验帮助学生了解C数据类型的位级表示和数据操作的位级行为。实验内容及操作步骤填...

2020-04-02 20:37:50 9603 7

原创 预备实验:安装Linux环境并进行编译和GDB调试

目录前言一、在所使用的电脑平台上安装linux系统与环境二、成功在linux系统中使用gcc完成简单c语言的编译和执行三、使用GDB进行程序基本的程序调试和反汇编实验结果及分析收获与体会前言本实验为课程预备实验,要求成功安装linux基本环境,并进行简单程序的编译和GDB调试,从而为后续课程实验搭建基础运行平台。仅供参考!一、在所使用的电脑平台上安装linux系统与环境下载并安装VMw...

2020-04-02 20:10:49 562

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除