自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(30)
  • 收藏
  • 关注

原创 anaconda环境下更新源、安装包 笔记

1 更换anaconda源分为Windows版和Linux版切换方式引用该文章2 conda安装包直接使用conda install XXX经常会找不到包>conda install nvidia-410Collecting package metadata (current_repodata.json): doneSolving environment: failed with initial frozen solve. Retrying with flexible solve.Co

2021-03-30 16:32:11 285

原创 Python xml模块学习笔记

XML处理模块警告 XML 模块对于错误或恶意构造的数据是不安全的。 如果你需要解析不受信任或未经身份验证的数据,请参阅 XML 漏洞 和 defusedxml 包部分。xml.dom 和 xml.sax 包的文档是 DOM 和 SAX 接口的 Python 绑定的定义。XML 处理子模块包括:xml.etree.ElementTree: ElementTree API,一个简单而轻量级的XML处理器。代码可用性好,速度快,消耗内存少。xml.dom:DOM API 定义。将 XML 数据在

2021-03-30 09:30:45 178

原创 Python os, shutil 使用笔记

1. os 模块os文档函数名描述os.getcwd()返回当前工作目录os.rename(src, dst)src和dst要么是dir,要么是filenameos.rmdir(path)删除指定路径os.listdir(path)返回指定路径下的文件和文件夹os.walk链接os.path很多os.path文档更多函数名描述os.path.isdir(path)判断路径是否为文件夹os.pa

2021-03-28 18:32:21 166

原创 使用ffmpeg随意剪辑、合并视频片段

ffmpeg剪辑时出现的问题ffmpeg 为了加速,会使用关键帧技术, 所以有时剪切出来的结果在起止时间上未必准确。上述原理会出现剪辑视频时,若开始时间处并不是关键帧,导致剪辑的片段开头有停顿。网上搜寻了一些解决方法,但是都不管用一种笨解决方案其中一种方法就是将视频关键帧间隔设为1,即视频所有秒数处都为关键帧。步骤从原视频剪出一个更长的片段,包含你需要的部分,且由于不知道关键帧在哪里,头尾处尽量延长一部分。# 从原片中00:00:30开始剪出10秒的片段ffmpeg -ss 00:

2021-03-12 20:54:47 1083

原创 安装CUDA, cuDnn, Tensorflow-gpu

1. CUDA cuDnn, Tensorflow-gpu 版本要对应Tensorflow官网给出的对应关系一定要注意版本对应关系比如我要安装Tensorflow-gpu 2.3.0,对应Python版本3.5~3.8, cuDnn版本7.6, CUDA版本10.1CUDA下载地址cuDnn下载地址pip安装Tensorflow-gpu:pip3 install tensorflow-gpu==2.3.02. 环境变量设置Tensorflow官网给出的环境变量设置规则CUDA和cuDn

2020-11-03 18:10:17 226

原创 PIP、Anaconda安装Python包的命令行

PIPpip --version 查看包版本pip install --upgrade pip 更新包pip uninstall XXX 删除包pip install XXX==2.1 安装2.1版本的XXX包pip install XXX>=2.1 安装大于2.1版本的XXX包pip list 列出已安装的包pip show 列出安装包pip install -i https://pypi.tuna.tsinghua.edu.cn

2020-10-25 16:03:53 1356

原创 C++ 用fgets 代替 gets

当读取未知长度字符串时,由于gets()未界定字符串最大长度,可能会造成缓存溢出。PAT 上使用新编译器,已不支持gets()。替代方法是使用gets_s() 或 fgets()。char * fgets(char * s, int n,FILE *stream);s: 字符型指针,指向存储读入数据的缓冲区的地址。n: 从流中读入n-1个字符stream : 指向读取的流使用...

2020-04-28 18:40:46 998

原创 PAT A 1025 PAT Ranking (25分)

题目地址: 点此进入题目要点题目给出n <= 100个测试,每个测试k< = 300行, 即最多有30000个考试记录。题目要求求出各个测试内部排行,以及所有记录的总排行。每读取完一个测试,即对此测试的记录进行排序,记录排行。所有记录都读取完后,再总的进行一次排序并记录排行。cmp函数要求:先按照分数排序;若分数相等,则按照id字典顺序排序。注: 常用排位方法 // 记...

2020-04-22 21:04:50 138

原创 PAT A 1016 Phone Bills 25分

题目地址:点此进入题目要点所有记录月份确定。题目要求按字典顺序输出用户信息,可使用map<名字, 记录>将记录分组。由题意可知,将记录按照时间顺序排序后,相邻的on-off对及此用户的一个有效记录。注意,题目保证所有记录中至少会有一对有效记录。但用户可能不止一个,所有没有有效数据的用户将没有输出信息。由于不知道用户是否有有效信息,一个简单的做法是将有效信息保存下来,稍后输...

2020-04-22 19:11:41 136

原创 数学问题: 素数判断的几种方法

素数的定义是,一个数除了1和本身,没有其他因数。几个事实:1不是素数也不是合数; 2是素数1. 基本方法一个数n,若存在k∈(1, n),使n % k == 0,则n为素数。而 n == k * (n/k),n/k 是n的一个因数。 k 与 n/k 中一定有一个大于sqrt(n),另一个小于sqrt(n),所以只要判断(1, sqrt(n))范围内是否存在n的因数即可。bool isPr...

2020-04-15 18:31:01 731

原创 BST(二叉查找树) 和 AVL(平衡二叉树)

BST 二叉查找树// 二叉查找树 BST// 定义:左子树上所有结点值小于等于根,右子树所有结点值大于根// 中序遍历,结果是有序的 // 查找 void search(node* root, int x) { if(root == NULL) return; if(root->data == x) printf("search success"); else if...

2019-07-15 22:25:50 232

原创 C++ STL

vector#include <cstdio>#include <vector> using namespace std;// 定义 vector<int> name;vector<vector<int> > name;vector<int> name[size];// 访问name[index]; ...

2019-07-09 23:24:02 119

原创 简单数学

最大公约数int gcd(int a, int b) { if(b == 0) return a; // 0 和 a的最大公约数是 a else return gcd(b, a % b);}// orint gcd(int a, int b) { return !b ? a : gcd(b, a % b);}最大公倍数int lcm(int a, int b) { int...

2019-07-07 21:18:41 129

原创 two pointers 双针法

顺序表a + b = mconst int maxn =110;int a[maxn], count = 0, n, m;int func() { int i = 0, j = n-1; while(i >= j) { if(a[i] + a[j] == m) { printf("%d + %d = %d\n", a[i], a[j], m); count++;...

2019-07-07 00:05:19 189

原创 二分法相关

数组有序寻找目标数字xint maxn = 110;int a[maxn];int Binary(int left, int right, int x){ int mid; while(left <= right) { mid = left + (right - left) / 2; if(a[mid] == x) return mid; else if(a[mid]...

2019-07-05 22:20:48 139

原创 Django+nginx服务器搭建纪要

配置及需要:阿里云学生机Ubuntu16.04Python3.5Django2.0nginxuwsgi1. 切换python版本1.1 安装python3,设置python3为默认Django2.0需要python3,而Ubuntu默认python版本为2.7,因此需要修改python默认版本查看现有python版本root@xxx:# update-alternativ...

2019-04-27 20:46:44 113

原创 PAT A1051 Pop Sequence(25 分)

解题思路按序读取所给的序列若读入的数字大于当前栈内最大数,则逐1进栈,直到和所读数相等;判断栈大小是否超过限制,注意此时栈顶元素不计数;若读入的数字小于当前栈内最大数,则逐1出栈,直到栈顶和所读数相等;若一轮循环后,栈大小超过限制或栈内仍有数字,则不能得到此序列。// 考试版 用数组模拟栈// A1051 Pop Sequence#include &amp;lt;cstdio&amp;gt...

2018-09-02 22:48:22 285

原创 PAT 最小路径题 Dijkstra+DFS模板

可用于求解最短路径问题,以及一些存在第二第三标尺,需要遍历路径的问题。#include &lt;cstdio&gt;#include &lt;vector&gt;#include &lt;cstring&gt;#include &lt;algorithm&gt;#include &lt;queue&gt;#include &lt;functional&gt;using namesp...

2018-09-01 23:53:44 337

原创 PAT 1072 Gas Station(30 分)

记录以字符串形式读入,再转换为数字n间房子,m个气站,共n+m个点循环Dijkstra得出 Gi 的最短距离,枚举判断是否有房子超过了覆盖范围,同时计算最小距离和平均距离题设要求的是求最小距离中的最大值#include &lt;cstdio&gt;#include &lt;vector&gt;#include &lt;map&gt;#include &lt;cstring&...

2018-09-01 23:43:46 303 1

原创 PAT 1021 Deepest Root 25

A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root i...

2018-08-28 01:04:39 906

原创 PAT 图的一般算法(伪代码)

1。广度优先搜索(BFS) bool visited[Max_vertex_num];void BEFTraverse(Graph G) { for (int i = 0; i &amp;amp;amp;amp;amp;amp;lt; G.vexnum; ++i) visited[i] = false; // 访问数组初始化 InitQueue(Q); for (int i = 0; i...

2018-08-16 20:42:09 2376

原创 PAT A1055 The World's Richest (25)

Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl...

2018-08-09 19:52:06 156

原创 PAT A1037 Magic Coupon (25)

The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that product b...

2018-08-09 00:11:20 128

原创 PAT A1067 Sort with Swap(0,*) (25)

Given any permutation of the numbers {0, 1, 2,…, N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2, ...

2018-08-09 00:04:34 106

原创 PAT A1089 Insert or Merge(25 分)

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data,...

2018-08-05 16:02:06 351

原创 CodeUp 递归小结 1903、2018、2044、2046(未完)

题目描述名名的妈妈从外地出差回来,带了一盒好吃又精美的巧克力给名名(盒内共有 N 块巧克力,20 &amp;amp;gt; N &amp;amp;gt;0)。 妈妈告诉名名每天可以吃一块或者两块巧克力。 假设名名每天都吃巧克力,问名名共有多少种不同的吃完巧克力的方案。 例如: 如果N=1,则名名第1天就吃掉它,共有1种方案; 如果N=2,则名名可以第1天吃1块,第2天吃1块,也可以第1天吃2块,共有2种方案; 如...

2018-08-04 00:36:27 158

原创 PAT A1095 Cars on Campus (30)

Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you a...

2018-08-03 16:21:21 119

原创 PAT A1080 Graduate Admission (30)

It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admissio...

2018-08-03 12:09:55 158

原创 PAT A1083 List Grades(25 分)

Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades ...

2018-08-02 14:51:50 168

原创 PAT A1029 Median(25 分)AC代码 成功解决内存超限 PAT已修复问题

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9, 10, 15, 16, 17 } is...

2018-08-02 08:27:01 1891

空空如也

空空如也

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

TA关注的人

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