- 博客(208)
- 资源 (9)
- 收藏
- 关注
原创 Linux服务器基于NFS实现共享目录
NFS简介:NFS(Network File System)是一种分布式文件系统协议,允许用户通过网络访问远程计算机上的文件和目录,就像访问本地文件一样。5、服务器B安装 nfs-utils、rpcbind,启用rpcbind。应用场景:服务器A将某目录设置为共享目录,服务器B可访问并写入。1、服务器A安装nfs-utils、rpcbind 软件包。6、服务器B创建目录,并挂载至服务器A的共享目录。2、服务器A设置共享目录与可访问的服务器。4、服务器A发布的NFS共享目录。
2024-08-09 16:39:17 339
原创 Segmentation fault问题解决
在Linux服务器中出现forrtl: severe(174):SIGSEGV, segmentation fault occurred。取消堆栈限制后,程序可正常运行。
2024-03-27 17:30:21 1733 1
原创 启用NTP服务解决Linux系统时间与北京时间不同步问题
1、服务器的Linux版本为Linux version 4.18.0-348.7.1.el8_5.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)) #1 SMP Wed Dec 22 13:25:12 UTC 2021。2、NTP即Network Time Protocol(网络时间协议),是一个互联网协议,用于同步计算机之间的系统时钟。
2023-11-03 16:32:01 1123
原创 GNSS卫星姿态解算
卫星的姿态指卫星的星体坐标轴XYZ在惯性系下的指向,其中Z轴始终指向地球地心,Y轴为卫星太阳能帆板的旋转轴,它始终与太阳-卫星方向垂直(为了最大程度地利用太阳辐射能量)。当然,Y轴同时也垂直于Z轴,最后的X轴与Y轴和Z轴组成右手坐标系。以上是卫星在非地影期间的姿态解算,然而在卫星地影期间则需考虑更多因素,首先需要求解太阳高度角β与卫星轨道角μ,其中β可以由轨道面法向向量W与xsun求得,在非地影期的数据解算过程中,我们已知惯性系下的太阳位置向量xsun,卫星位置向量xsat,卫星速度向量vsat。
2023-10-31 23:22:28 380
原创 Leetcode43:接雨水(动态规划)
解释:上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。输入:height = [0,1,0,2,1,0,1,3,2,1,2,1]输入:height = [4,2,0,3,2,5]...
2022-08-29 17:47:21 500 1
原创 滑动窗口模板(leetcode76 最小覆盖子串)
给你一个字符串 s 、一个字符串 t。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 ""。对于 t 中重复字符,我们寻找的子字符串中该字符数量必须不少于 t 中该字符数量。输入:s = "ADOBECODEBANC", t = "ABC"解释: t 中两个字符 'a' 均应包含在 s 的子串中,如果 s 中存在这样的子串,我们保证它是唯一的答案。输入: s = "a", t = "aa"输入:s = "a", t = "a"...
2022-08-28 21:53:35 196
原创 C++remove和erase
remove(str.begin(),str.end(),val);remove是将strz中等于val的值用后一个值覆盖,并返回最后一个未被删除的元素的下一个迭代器:若str为"abcaad"对'a'remove后则变为"bcdaaa"配合erase可将所有a删除str.erase(remove(str.begin(),str.end(),val),str.end());...
2022-04-05 23:40:13 1222 1
原创 C++求解最大公约数和最小公倍数
最大公约数(greatest common diversor)int gcd(int x,int y){ if(y%x==0) return x; return gcd(y%x,x);}最小公倍数(lowest common multiple)int lcm(int x,int y){ return x*y/gcd(x,y);}
2022-04-05 19:32:22 995
原创 卫星广播星历格式
1、GPS广播星历G01 2022 01 04 00 00 00 4.665437154472E-04-1.000444171950E-11 0.000000000000E+00 7.300000000000E+01-4.275000000000E+01 4.347323940635E-09-5.174246376131E-01 -2.102926373482E-06 1.122187799774E-02-4.135072231293E-07 5.153668924332E+03...
2022-03-15 15:22:27 5794 4
原创 剑指 Offer 10- II. 青蛙跳台阶问题(矩阵快速幂)
class Solution {public: typedef vector<vector<long>> vvl; vvl multiply(vvl& a,vvl& b){ vvl c={{1,0},{0,1}}; for(int i=0;i<2;i++){ for(int j=0;j<2;j++){ c[i][j]=(a[i][...
2022-02-19 21:02:13 571 2
原创 【代码模板】快速幂(递归+迭代)+矩阵快速幂(递归+迭代)
class Solution {public: double myPowHelper(double x, long n){ if(n==0) return 1; double y=myPowHelper(x,n/2); return n&1?y*y*x:y*y; } double myPow(double x, int n) { long n_long=n;//INT_MIN绝对值比INT_MAX大1,取反.
2022-02-19 16:41:15 210
原创 剑指Offer004:只出现一次的数字
方法一:哈希表,需要额外空间class Solution {public: int singleNumber(vector<int>& nums) { unordered_map<int,int> hash_map; for(auto& num:nums){ hash_map[num]++; } for(auto& [val,count]:hash_ma..
2022-02-19 13:41:25 97
原创 剑指Offer003:前 n 个数字二进制中 1 的个数
方法一:bitset容器class Solution {public: vector<int> countBits(int n) { vector<int> ans; for(int i=0;i<=n;i++){ bitset<32> bs(i); ans.push_back((int)bs.count()); } return ans..
2022-02-19 13:16:06 353
原创 剑指Offer002:二进制加法
class Solution {public: string addBinary(string a, string b) { int idx_a=a.size()-1,idx_b=b.size()-1; string ans=""; int carry=0;//进位初始化为0 while(idx_a>=0||idx_b>=0||carry!=0){ int sum=carry; ...
2022-02-19 12:15:39 7516
原创 剑指Offer001:整数除法
提示:-231<= a, b <= 231- 1 b != 0class Solution {public: int divide(int a, int b) { bool sign=(a^b)>>31;//判断a和b是否异号,右移31位到符号位 long dividend=abs((long)a),divisor=abs((long)b);//转为正数 long ans=0; while(d...
2022-02-19 12:11:31 268
原创 Leetcode688:骑士在棋盘上的概率(动态规划)
On an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top-left cell is (0, 0), and the bottom-right cell is (n - 1, n - 1).A chess knight has eight possible move
2022-02-17 13:19:28 460
原创 Leetcode1719:重构一棵树的方案数(拓扑)
You are given an array pairs, where pairs[i] = [xi, yi], and:There are no duplicates.xi < yiLet ways be the number of rooted trees that satisfy the following conditions:The tree consists of nodes whose values appeared in pairs.A pair [xi, yi] exi
2022-02-16 15:08:11 312
原创 Leetcode297:二叉树的序列化与反序列化(广搜)
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer env
2022-02-15 20:14:12 446
原创 Leetcode236:二叉树的最近公共祖先(广搜)
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as d
2022-02-14 21:33:08 75
原创 Leetcode116:填充每个节点的下一个右侧节点指针(层序遍历)
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node { int val; Node *left; Node *right; Node *next;}Populate each next pointer t...
2022-02-12 16:58:57 212
原创 Leetcode105:从前序与中序遍历序列构造二叉树(哈希表+递归)
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.Constraints:1 <= preorder.length <= 3000inorder.l
2022-02-12 15:55:29 197
原创 Leetcode106:从中序与后序遍历序列构造二叉树(哈希表+递归)
Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the same tree, construct and return the binary tree.Constraints:1 <= inorder.length <= 3000posto
2022-02-12 15:37:16 333
原创 Leetcode1020:飞地的数量(广搜)
You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell.A move consists of walking from one land cell to another adjacent (4-directionally) land cell or walking off the boundary of the grid.Return the numbe
2022-02-12 14:44:57 312
原创 Leetcode1984:学生分数的最小差值(排序+划窗)
You are given a 0-indexed integer array nums, where nums[i] represents the score of the ith student. You are also given an integer k.Pick the scores of any k students from the array so that the difference between the highest and the lowest of the k score
2022-02-11 11:22:10 510
原创 Leetcode2006:差的绝对值为K的数对数目(哈希表)
Given an integer array nums and an integer k, return the number of pairs (i, j) where i < j such that |nums[i] - nums[j]| == k.The value of |x| is defined as:x if x >= 0.-x if x < 0.Constraints:1 <= nums.length <= 200 1 <= num
2022-02-09 12:11:39 5968
原创 Leetcode1405:最长快乐字符串(贪心)
A string s is called happy if it satisfies the following conditions:s only contains the letters 'a', 'b', and 'c'.s does not contain any of "aaa", "bbb", or "ccc" as a substring.s contains at most a occurrences of the letter 'a'.s contains at most b o
2022-02-07 17:39:23 594
原创 Leetcode1748:唯一元素的和(哈希表)
You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array.Return the sum of all the unique elements of nums.Constraints:1 <= nums.length <= 100 1 <= nums[i] <= 100clas
2022-02-06 17:30:11 331
原创 Leetcode1219:黄金矿工(DFS+lambda表达式)
In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty.Return the maximum amount of gold you can collect under the conditions:Every time you are located in a cell you will
2022-02-05 12:11:32 1464
原创 Leetcode1414:和为K的最小斐波拉契数字数目(贪心+二分)
Given an integer k, return the minimum number of Fibonacci numbers whose sum is equal to k. The same Fibonacci number can be used multiple times.The Fibonacci numbers are defined as:F1 = 1F2 = 1Fn = Fn-1 + Fn-2 for n > 2.It is guaranteed that for
2022-02-03 16:07:07 751
原创 Leetcode1349:参加考试的最大学生数(动态规划+状态压缩+位运算)
Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character.Students can see the answers of those sitting next to the left, right, upper left
2022-02-02 17:22:18 599
转载 C++ char*,const char*,string,int的相互转换
1.string转const char*string s ="abc";constchar* c_s = s.c_str();2.const char*转stringconstchar* c_s ="abc";string s(c_s);3.string转char*string s ="abc";char* c;constintlen = s.length();c =newchar[len+1];strcpy(c,s.c_str());4.c...
2021-11-07 22:21:32 1687
原创 基于Python实现的Vondrak滤波
修匀数学中指出一个修匀序列应该满足光滑性的要求,而传统的计算光滑性的一个数值度量的方法就是计算修匀数列的某些阶(最常用的是3阶或者4阶)的有限差分,通常采用下式计算:式中:z为差分的阶数,n为待处理的数据的个数,S为平滑度。光滑性的要求就是在满足S很小的情况下,所得出的修匀值位于一条光滑的曲线上。上式中的S定义为平滑度或者粗糙度,其中差分的阶数z通常取3或者4。平滑度S越小说明获得的曲线越平滑,当S的的值达到极限值零时,此时所有的平滑值位于一条直线上...
2021-08-18 19:53:18 482
原创 vscode调试Python显示完整的超大列表
vscode调试窗口默认仅显示300个元素,需要在pydevd_resolver.py文件中进行修改更改该值的大小即可
2021-08-17 16:17:47 1393
毕业论文大礼包.rar
2020-07-18
白塞尔大地主体解算(正算+反算)
2018-06-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人