自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

剑似生平

自庇一身青箬笠,相随到处绿蓑衣。斜风细雨不须归

  • 博客(559)
  • 资源 (3)
  • 收藏
  • 关注

原创 UVA10881 Piotr‘s Ants

#include <iostream>#include <cstdio>#include "bits/stdc++.h"#define ll long longusing namespace std;const int maxn = 10000 + 5;int L,T,n;struct Ant{ int id; int p; // 位移 int d; // L -1 R 1 bool operator < (const Ant

2021-12-08 10:33:59 623

原创 UVA-11520 Fill the Square

思路:因为要求是字典序,这道题的第一反应就是从A-Z选取字母,在正方形中从上到下,从左到右这样的顺序去填字母,一旦判断这个字母旁边没有和它一样的,那么就证明这个字母就是正确答案,继续填下一个字母。#include <iostream>#include "bits/stdc++.h"using namespace std;int T,n;vector<vector<char>>grid(10,vector<char>(10));bool safe

2021-11-19 10:15:25 550

原创 UVA-11300

#include <iostream>#include "bits/stdc++.h"#define ll long longusing namespace std;int main() { int N; while(scanf("%d",&N) == 1) { vector<ll>a(N+1),c(N,0); ll tmp = 0; for(int i = 1;i<=N;i++)

2021-11-19 09:07:35 552

原创 UVa 11729

思路:这道题是一个贪心算法,因为任意两个排在一起的工作,它们的时间相加都是b1+b2+max(j1,j2),所以要把时间最长的放在前面。#include <iostream>#include "bits/stdc++.h"using namespace std;struct Job{ int j,b; bool operator < (const Job & x)const{ return j > x.j; }};i

2021-11-18 15:51:38 74

原创 UVA11292

题目:勇者斗恶龙思路:首先排序,然后一个一个去比较。#include <iostream>#include "bits/stdc++.h"using namespace std;int main() { int n,m; while(cin>>n>>m&&(n||m)) { vector<int>d(n),p(m); for(int i = 0;i<n;i++)

2021-11-18 15:49:40 94

原创 秋招的感想

今年秋招,感觉兵荒马乱的。不过好在现在已经拿到了心仪的ali offer,希望以后会越来越好!

2021-10-27 15:57:16 95

原创 解决github上传大于100MB文件失败

首先下载git LFS:https://git-lfs.github.com/然后git执行如下命令git lfs install # 安装git lfs track "*.caffemodel" # "*.caaffemodel",由于我要上传的是model文件,所以是.caffemodel结尾,大家可以根据文件格式自行调整git add .git commit -m "information"git push -u origin main # 命令执行完成后,提示文件上传成功..

2021-05-17 10:52:54 183

原创 剑指 Offer 18. 删除链表的节点

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* deleteNode(ListNode* head, int val) { ListNode* H

2021-05-11 10:09:28 55

原创 剑指 Offer 17. 打印从1到最大的n位数

class Solution {public: vector<int> printNumbers(int n) { vector<int>ans; for(int i = 1;i<=pow(10,n)-1;i++) ans.push_back(i); return ans; }};

2021-05-11 10:08:57 59

原创 剑指 Offer 16. 数值的整数次方

class Solution {public: double myPow(double x, int n) { double ans = 1; double a = x; long n1 = n; int flag = n1<0 ? 1 : 0; n1 = abs(n1); while(n1) { if(n1&1)

2021-05-11 10:08:30 57

原创 剑指 Offer 15. 二进制中1的个数

class Solution {public: int hammingWeight(uint32_t n) { bitset<32>b(n); return b.count(); }};

2021-05-11 10:07:17 55

原创 剑指 Offer 14- II. 剪绳子 II

class Solution {public: int cuttingRope(int n) { if(n <= 2) return 1; if(n == 3) return 2; long ans = 1; while(n > 4) { ans = (ans*3)%1000000007; n-=3; } ans = (ans*

2021-05-11 10:06:47 73

原创 剑指 Offer 14- I. 剪绳子.md

class Solution {public: int cuttingRope(int n) { if(n <= 3) return n-1; int cnt = n/3; int t = n-cnt*3; if(t == 0) return pow(3,cnt); if(t == 1) return pow(3,cnt-1)*4; return pow(3,c

2021-05-11 10:06:11 84

原创 剑指 Offer 13. 机器人的运动范围

class Solution {public: int movingCount(int m, int n, int k) { vector<vector<bool>>vis(m,vector<bool>(n,false)); int dx[4] = {-1,1,0,0}; int dy[4] = {0,0,1,-1}; queue<pair<int,int>>q;

2021-05-10 09:53:19 66

原创 剑指 Offer 11. 旋转数组的最小数字

class Solution {public: int minArray(vector<int>& numbers) { int low = 0,high = numbers.size()-1; while(low<high) { int mid = low + (high-low)/2; if(numbers[mid]<numbers[high]) high = mid

2021-05-10 09:51:35 49

原创 剑指 Offer 10- II. 青蛙跳台阶问题

class Solution {public: int numWays(int n) { vector<int>dp(n+1,1); if(n>=2) { dp[1] = 1; for(int i = 2;i<=n;i++) { dp[i] = (dp[i-1]+dp[i-2])%1000000007;

2021-05-10 09:49:21 50

原创 剑指 Offer 10- I. 斐波那契数列

class Solution {public: int fib(int n) { if(n<=1) return n; vector<int>dp(n+1,0); dp[1] = 1; for(int i = 2;i<=n;i++) { dp[i] = (dp[i-1]+dp[i-2])%1000000007; } ret

2021-05-10 09:42:18 49

原创 剑指 Offer 09. 用两个栈实现队列

class CQueue {stack<int>s1,s2;public: CQueue() { } void appendTail(int value) { s1.push(value); } int deleteHead() { while(!s1.empty()) { int t = s1.top();

2021-05-10 09:41:45 52

原创 剑指 Offer 07. 重建二叉树

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: TreeNode* buildTree(vector<i

2021-05-10 09:41:06 49

原创 剑指 Offer 06. 从尾到头打印链表

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: vector<int> reversePrint(ListNode* head) { vector<i

2021-05-10 09:40:09 49

原创 剑指 Offer 05. 替换空格

class Solution {public: string replaceSpace(string s) { for(int i = 0;i<s.size();i++) { if(s[i] == ' ') { s = s.substr(0,i)+"%20"+s.substr(i+1,s.size()-i-1); i+=2;

2021-05-10 09:39:36 43

原创 剑指 Offer 04. 二维数组中的查找

class Solution {public: bool findNumberIn2DArray(vector<vector<int>>& matrix, int target) { int r = matrix.size()-1; int c = 0; while(r >= 0 && c < matrix[0].size()) {

2021-05-10 09:39:01 40

原创 剑指 Offer 03. 数组中重复的数字

class Solution {public: int findRepeatNumber(vector<int>& nums) { int zero = 0; for(int i = 0;i<nums.size();i++) { if(nums[abs(nums[i])] == 0) zero++; nums[abs(nums[i])] = -nums[abs(nums[i])

2021-05-10 09:38:12 47

原创 leetCode201

class Solution {public: int rangeBitwiseAnd(int left, int right) { int i = 0; while(left != right) { left >>= 1; right >>= 1; i++; } return left << i; }

2021-04-16 15:57:22 177

原创 golang 双向链表的使用方法

element.Value存储的是放在list的元素值使用范例:package mainimport ( "container/list" "fmt")func printList(l *list.List){ for e := l.Front(); e!=nil;e = e.Next(){ fmt.Print(e.Value ," ") } fmt.Println("--------------------------")}func main() { l := li.

2021-04-01 09:22:03 157

原创 go dep download

git clone https://github.com/golang/dep.gitcd depchmod a+x install.sh./install.shresult:./install.shARCH = armOS = linuxWill install into /home/pi/go/binFetching https://github.com/golang/dep/releases/latest..Release Tag = v0.5.4Fetching https

2021-03-08 09:11:15 191

原创 关了代理后配置GOPATH

export GOPROXY=https://goproxy.cnexport GO111MODULE=on

2021-03-08 08:12:40 138

原创 [Errno 13] Permission denied: ‘/home/nvidia/.aws/credentials‘

1. 在配置aws configure时,会遇到如下的问题:[Errno 13] Permission denied: '/home/nvidia/.aws/credentials'2. 然而,如果用sudo aws configure,配好之后,再用如下命令测试:aws s3 ls就会发现:Unable to locate credentials. You can configure credentials by running "aws configure".3.再用aws

2021-03-06 11:25:33 779

原创 docker(Windows换源)

首先去阿里云搜容器镜像服务:然后看到:3.打开docker setting:把里面的内容替换一下,restart即可。

2021-02-28 10:08:38 678

原创 leetCode101

这道题的话,应该自信一点,就是一道很简单的判断两颗树是否一样的反转题。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x),

2021-02-24 20:02:35 55

原创 leetCode 91. 解码方法

这道题我一开始想用的是dfs,但是超时了。为什么会超时呢,应该是它的状态转移方程其实是只用两种情况的,而且没有那么多种变化情况需要记录,比如说如果是记录下不同的解码字符串,那么就要dfs,但是这里其实只要加减就可以了,所以应该想到用dp.index表示的是以当前字符作为结尾时一共有多少种解码情况。有两种,一种是以一个字符加进去,还有一种就是要结合前一个字符,即10-16.0的话要特殊判断一下,或者不在1-26时就要拆成一个一个的,不可能作为10-26来解码。class Solution {p

2021-02-24 19:53:35 76

原创 LeetCode75. 颜色分类

class Solution {public: void sortColors(vector<int>& nums) { int low = 0,high = nums.size()-1; int i = 0; while(low < high) { if(i == nums.size()) return; if(nums[i] == 0).

2021-02-24 19:28:16 50

原创 LeetCode 81. 搜索旋转排序数组 II

这道题我觉得用这张图就可以很好地表现出来,而且还很具体class Solution {public: bool search(vector<int>& nums, int target) { int low = 0,high = nums.size()-1; while(low <= high) { int mid = low + (high - low)/2; if(n

2021-02-24 19:07:41 46

原创 go build很慢的情况

我的情况是关掉杀毒软件就快了好多~

2021-02-23 08:24:50 1876 1

原创 sam build这个过程都发生了什么

讲一下这个流程都发生了什么awsdocs/aws-sam-developer-guide 将函数部署成程序包有两种方式: Image:lambda提供了一组开源基本镜像,比如说python3.7 python3.8等,部署好的容器镜像可以上传到Amazon ECR进行托管,将部署好的镜像用以函数时,应该指定Amazon ECR镜像的URL。 Zip: 比较麻烦,是将程序代码和依赖项进行打包,如果需要部署程序时,需要手动上传程序包到lambda。 sam init 创.

2021-02-22 21:09:57 270

原创 aws sam build使用docker下载库时非常慢

在dockerfile里面加上换源的语句:RUN pip config set global.index-url http://mirrors.aliyun.com/pypi/simpleRUN pip config set install.trusted-host mirrors.aliyun.com然后需要注意的是,因为在修改代码之后需要重新sam build一次,而构建镜像是是一层一层加上去的,因此应该把pip install那些库的层放在下层,而把app.py(即主程序)copy进bui

2021-02-22 21:06:58 286

原创 PAT 甲级 1027 Colors in Mars

People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. The only

2020-11-13 19:21:52 73

原创 JetPack 4.4安装教程(本人亲自踩坑,超详细)

TX刷机花了很长很长的时间。刷机过程中遇到很多的问题,踩过很多的坑,失败了很多次。最后还是在实验室大佬(lk)的帮助下才刷成的。过程中遇到的问题主要还是网络问题。刷机主要依照教程,《Jetson TX2 使用 SDK Manager刷机》https://blog.csdn.net/u012254599/article/details/100009909附带一张jetson按钮说明书,​ 再附带官方教程,https://docs.nvidia.com/sdk-mana

2020-11-12 20:00:37 3910

原创 剑指 Offer 60. n个骰子的点数

题目把n个骰子扔在地上,所有骰子朝上一面的点数之和为s。输入n,打印出s的所有可能的值出现的概率。你需要用一个浮点数数组返回答案,其中第 i 个元素代表这 n 个骰子所能掷出的点数集合中第 i 小的那个的概率。思路 这道题是老dp了。首先,为什么会想到dp呢?这道题明显只有两个变量,一个是骰子的数量,一个就是n个骰子所可以组成的数。明显我们需要求出所有的子问题,才可能知道答案。那么,确认了问题之后,我们开始划分模型,前n个骰子和前n-1个骰子之间的联系是什么呢?我们很容易可以想到是增加1-6。

2020-10-30 10:28:50 87

原创 剑指 Offer 32 - III. 从上到下打印二叉树 III

这道题目比较简单。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<vector<int>>

2020-10-24 21:21:50 90

最短迷宫路径求解

这个是数据结构的最短迷宫求解路径,通过广义搜索求解.

2018-04-13

逆波兰的程序

数据结构的作业,逆波兰的程序,写了挺久的,希望大家喜欢.

2018-03-25

学生管理系统数据库

学生管理系统数据库,自己做的~.....................................................................................................................

2018-03-13

空空如也

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

TA关注的人

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