自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 资源 (3)
  • 收藏
  • 关注

原创 [leetcode] 70. Climbing Stairs 爬楼梯问题

斐波那契额数列问题。You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note:Givennwill ...

2019-08-31 21:21:49 136

原创 [PAT甲级] 1094 The Largest Generation

题意大致为一个多叉树家谱,给出N个成员 1 - N,M个子树,子树分别为父节点号,子节点数,子节点编号组成,要求给出最多成员的那一层的成员数以及层数。题目不算复杂,开始时都设为第一层,当每读一行时就把子节点的level变为父节点level+1,并将该子节点的所有子节点以及子孙结点递归增加为改变后子节点的层数累加1,原来各层也要-1,这里可以用到类似深搜递归的子函数,直到最后读完所有的关系,每层...

2019-08-31 21:10:47 96

原创 【PAT甲级】1011 World Cup Betting

这题好像很简单?就是求三行各行的最大值相乘再进行运算即可: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 Worl...

2019-08-31 20:09:22 103

原创 【PAT乙级】1007 素数对猜想

素数筛法问题,给出一个数N,求不大于N的所有相差为2且相邻的素数对的对数:让我们定义d​n​​为:d​n​​=p​n+1​​−p​n​​,其中p​i​​是第i个素数。显然有d​1​​=1,且对于n>1有d​n​​是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。现给定任意正整数N(<10​5​​),请计算不超过N的满足猜想的素数对的个数。输入格式:输入在一...

2019-08-31 19:44:23 150

原创 [PAT乙级] 1021 个位数统计

题目描述:即统计输入大数的各字符的不为0的数字的出现频率给定一个k位整数N=d​k−1​​10​k−1​​+⋯+d​1​​10​1​​+d​0​​(0≤d​i​​≤9,i=0,⋯,k−1,d​k−1​​>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N=100311,则有 2 个 0,3 个 1,和 1 个 3。输入格式:每个输入包含 1 个测试用例...

2019-08-31 19:31:10 96

原创 【pat甲级】1007 Maximum Subsequence Sum

题目描述:Given a sequence ofKintegers {N​1​​,N​2​​, ...,N​K​​}. A continuous subsequence is defined to be {N​i​​,N​i+1​​, ...,N​j​​} where1≤i≤j≤K. The Maximum Subsequence is the continuous s...

2019-08-31 11:44:16 102

原创 [PAT甲级]1003 Emergency

求最短路径的问题,用dj算法来解决,注意添加了条件,当路径长度相等时,优先选择救援队较多的路径;其次,要算出最短路径的条数,可以设置num_t[100]数组,记录从开始结点到当前结点 i 的最短路径的条数,而后面的相邻结点 j 若可以通过 i 以最短路径长度到达则 += num_s[i]即可,每次获得一个newP即是知道它的所有最短路径,找出所有能直连它的已经加入到newP过的即可。As a...

2019-08-31 11:01:52 82

原创 【PAT乙级】1011 A+B 和 C

用longlong存储解决问题:给定区间 [−2​31​​,2​31​​] 内的 3 个整数A、B和C,请判断A+B是否大于C。输入格式:输入第 1 行给出正整数T(≤10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。输出格式:对每组测试用例,在一行中输出Case #X: true如果A+B&gt...

2019-08-31 09:24:43 131

原创 【PAT乙级】1017 A除以B

问题是简单的高精度除法问题:本题要求计算A/B,其中A是不超过 1000 位的正整数,B是 1 位正整数。你需要输出商数Q和余数R,使得A=B×Q+R成立。输入格式:输入在一行中依次给出A和B,中间以 1 空格分隔。输出格式:在一行中依次输出Q和R,中间以 1 空格分隔。输入样例:123456789050987654321 7输出...

2019-08-31 09:11:27 118

原创 [leetcode] 287. Find the Duplicate Number (查找数组中重复的数)

找出重复的数,已知数组中重复的数只有1个,要求不能使用额外的空间。Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Assume that th...

2019-08-30 20:02:25 147

原创 [leetcode]344. Reverse String

题目比较简单,翻转char[]字符数组:问题描述:Write a function that reverses a string. The input string is given as an array of characterschar[].Do not allocate extra space for another array, you must do this bym...

2019-08-26 17:54:09 85

原创 [leetcode] 58. Length of Last Word (字符串的末尾单词的长度)

简单题,求给出的字符串的最后一个单词的长度,要注意的是字符串的末尾可能是空格,要跳过空格。Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word ...

2019-08-25 16:22:54 108

原创 递归和分治问题

1. 输出字符串的全排列:采用递归的方式,交换两个字符,然后再输出打印:#include<bits/stdc++.h>using namespace std;void V(string s, int i, int n){ if(i == n - 1) { cout << s << endl; re...

2019-08-24 16:48:08 135

原创 动态规划(poj):上楼梯问题的改进版

poj上机考试题目描述:D:上楼梯描述小S在玩一个叫上楼梯的游戏。楼梯一共有n层台阶。因为腿长的限制,小S每次最多只能上k层台阶。小S是一个迷信的人,所以他不希望自己某一步走的步数的数字里有"4",(比如4,14,44都含有数字"4")。现在,小S想要知道,有多少种走完这n层台阶的方案?输入输入包含多组数据。每组数据第一行输入一个整数 n, k(1 &lt...

2019-08-23 16:39:01 1153

原创 石头移动问题(POJ河中跳房子)

poj上问题链接河中跳房子给出 L, N,M,L表示两岸最左边和最右边的石头的距离,最左边和最右边的石头不能移动,中间有N块石头都可以移走,要求移出M块石头,要求给出移出M块石头所能得到的移出后相邻两块石头间最短距离的最大值(因为移出不同的M块石头,所有相邻两块石头间的最小值可以不相同)。其次给出N行,分别表示距离最左边石头的距离:最左边和最右边的石头距离最左边的石头的距离分别为a[0...

2019-08-23 15:12:02 877

原创 绳子切割问题(枚举与二分)

绳子切割问题:给出N条绳子的长度,问按照一定长度 LG切割这几条绳子得到至少 k 条肠胃 LG 的绳子,问长度L最长为多少,保留2位小数。方法1:枚举法:绳子从0.01米开始增加,每次增加 0.01 米,直到 L[i] / LG之和小于k,则此时的LG - 0.01就是题目要求的答案:代码为:#include<cstdio>#include<iostream...

2019-08-21 20:31:35 1099

原创 [leetcode]1038. Binary Search Tree to Greater Sum Tree

问题描述:Given the root of a binarysearchtree with distinct values, modify it so that everynodehas a new value equal to the sum of the values of the original tree that are greater than or equal to...

2019-08-21 19:42:02 133

原创 【LeetCode】2. Add Two Numbers 链表相加(new)

这题还是比较有难度的。题目的意思是两个链表相加得到一个新的链表,链表的长度可能不相等,将每个相应结点的值存储在一个链表上,当该值大于10时,将该值进位到结果链表的下一个结点上,要注意的几点是最后的值可能会超出 l1 和 l2的长度,也要注意如何处理 l1 和 l2的长度不相等的情况。You are given twonon-emptylinked lists representing t...

2019-08-21 15:47:27 119

原创 【PAT乙级】1004 成绩排名

简单的排序问题:读入n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含 1 个测试用例,格式为第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ...第 n+1 行:第 n 个学生的姓名 学号 成绩其中姓名和学号均为不超过...

2019-08-20 15:56:12 83

原创 【PAT乙级】1093 字符串A+B

注意PAT平台不支持gets()函数,用getline(cin, str)来读取一行,这种方式只能处理string类,不能处理char型数组,同时也要注意用string 类只能使用cin>> 与 cout<< 。cin.getline(str, int size)处理char型数组。给定两个字符串A和B,本题要求你输出A+B,即两个字符串的并集。要求先输出A...

2019-08-20 10:56:01 210

原创 215. Kth Largest Element in an Array 求数组中第k大的数

问题看起来比较简单,只要进行简单的排序即可,因为标注了堆,就使用了堆进行一下求解:Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:...

2019-08-19 13:15:05 99

原创 【leetcode】53. Maximum Subarray 连续子序列最大值问题:动态规划

前面已经遇到了这一题目,就是简单的求给定数组的连续子序列的最大和。各元素必须直接相连。Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input...

2019-08-19 12:59:26 183

原创 stl中 map 的简单使用

map<char, int>, map<string ,int>都可以定义,但是不能用map<char[] ,int>这种char型数组,主要的几个操作是,map[a] = 1,用 iterator->first, iterator->second分来访问键与值,size(), clear(), find('a')返回迭代器,erase(it) ...

2019-08-18 21:46:29 128

原创 【leetcode】242. Valid Anagram

暴力解决问题是很简单的,这里主要学习了map的使用。Given two stringssandt, write a function to determine iftis an anagram ofs.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s =...

2019-08-18 21:33:17 90

原创 【leetcode】496. Next Greater Element I

问题比较简单,给出两个数组,求第二个数组中与第一个数组中某元素a相同的右边的第一个某一元素b,使得b大于a,数组1是数组2的一个子集。You are given two arrays(without duplicates)nums1andnums2wherenums1’s elements are subset ofnums2. Find all the next greate...

2019-08-18 21:07:59 100

原创 【leetcode】38. Count and Say

题目看起来非常的奇怪,点踩的人也非常的多。先看题目的描述:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211is read off ...

2019-08-18 20:08:43 85

原创 动态规划之矩阵连乘问题

对于矩阵相乘来说, A1(p * q), A2(q * x), A3(x * y) 。。。连乘问题,(A1 * A2) * A3 与 A1 * (A2 * A3)的矩阵乘法的总次数是不同的,分别为 p* q * x + p * x * y 与 q * x * y + p * q * y,两者的值是不相等的,由此可知通过在矩阵连乘中添加括号,改变连乘的顺序可以得到最少的连乘次数。递推公式为:...

2019-08-17 16:40:38 366

原创 【leetcode】73. Set Matrix Zeroes矩阵置0问题

问题是将矩阵中所有0所在的行与列全部置0.Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do itin-place.Example 1:Input: [ [1,1,1], [1,0,1], [1,1,1]]Output: [ [1,0,1], ...

2019-08-17 15:30:35 104

原创 【leetcode】102. Binary Tree Level Order Traversal 层序遍历递归形式(全局变量)

二叉树层序遍历递归形式的解决,一般问题都是直接打印遍历的结果,这里要将每一层的结果按照层进行打印,用队列的方式可能存在一些问题。这里采用了递归的方式进行解决。Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level)....

2019-08-17 14:35:24 137

原创 【leetcode】120. Triangle

问题是求一个直角三角形从上到下的和最小的路径,要求每一行的路径要么是上一行对应列而来,要么是上一行对应列-1即斜对角线而来。问题描述:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For ...

2019-08-15 23:24:27 93

原创 【leetcode】169. Majority Element 求众数

要求求出给定数组中出现频率大于 n / 2的数,那么这个数显然只可能有1个。题目为:Given an array of sizen, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋times.You may assume that the a...

2019-08-14 23:46:07 102

原创 【leetcode】100. Same Tree

判断两棵树是否相同,可以根据先序遍历和中序遍历或中序遍历及后序遍历是否一致来判断,也可以根据简单的递归方式来解决。Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structu...

2019-08-14 21:09:19 98

原创 [Leetcode] 392. Is Subsequence

看起来应该是一个简单的求子串的问题。Given a stringsand a stringt, check ifsis subsequence oft.You may assume that there is only lower case English letters in bothsandt.tis potentially a very long (lengt...

2019-08-12 00:11:46 125

原创 [leetcode] 122. Best Time to Buy and Sell Stock II

这是一个非常简单贪心问题,贪心问题的解决方法一般都非常简单,但是要想到这个方法真的挺不容易的:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may compl...

2019-08-11 22:39:23 116

gxemul-0.6.0.1.tar.gz

gxemul 是一款模拟器,可以作为虚拟机使用,支持mips,x86等基本架构类型。这是它的0.6.0.1版本,需要查看支持龙芯的版本可以查看我上传的其它该软件的版本。

2020-10-16

gxemul-0.4.3

可以仿真龙芯处理器的模拟器,在这个平台上针对龙芯进行os或者其它工具的开发。 较高版本的该模拟器已经不支持龙芯了。 注意模拟器中的龙芯叫做Godson,Godson是龙芯早期的称呼,而不叫Loongson。

2020-10-15

mips-2007-01-21.iso

这是北航小操作系统课程设计所使用的交叉编译器,它的安装过程可以参照以下步骤: #建立一个用于挂载iso文件的目录 mkdir /mnt/mipsiso #挂载iso文件 mount -o loop mips-2007-01-21.iso /mnt/mipsiso cd /mnt/mispiso #在64位系统中安装32位运行库 apt-get install ia32-libs #运行安装脚本 ./install -d /opt/eldk 检查/opt/eldk文件夹下是否有mips_4KC开头的一系列工具。 运行./mips_4KC-gcc是否能输出打印正确信息 安装完毕

2020-10-15

空空如也

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

TA关注的人

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