自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

努力中的老周的专栏

一个不断努力的程序猿

  • 博客(29)
  • 资源 (5)
  • 收藏
  • 关注

原创 Win10 WSL2 安装的 Ubuntu 18.04 使用 GUI

系统状态Win10 + WSL2 的 Ubuntu 18.04。+WSL2 安装 Ubuntu 18.04安装方法请看这个文章,https://blog.csdn.net/justidle/article/details/108469797。启动 xrdp 的 GUI更新系统到最新版本这个步骤必不可少了。sudo apt updatesudo apt upgrade安装 xrdpsudo apt install xrdp安装 xfce4sudo apt

2020-09-30 15:06:58 3366 2

原创 洛谷题解——P2814 家谱

题目相关题目链接洛谷,https://www.luogu.com.cn/problem/P2814。MYOJ,http://47.110.135.197/problem.php?id=5344。题目描述给出充足的父子关系,请你编写程序找到某个人的最早的祖先。输入格式输入由多行组成,首先是一系列有关父子关系的描述,其中每一组父子关系中父亲只有一行,儿子可能有若干行,用 #name 的形式描写一组父子关系中的父亲的名字,用 +name 的形式描写一组父子关系中的儿子的名字;接下来用

2020-09-29 18:40:02 452

原创 洛谷题解——P1621 集合

题目相关题目链接洛谷,https://www.luogu.com.cn/problem/P1621。MYOJ,http://47.110.135.197/problem.php?id=5342。题目描述Caima 给你了所有 [a,b] 范围内的整数。一开始每个整数都属于各自的集合。每次你需要选择两个属于不同集合的整数,如果这两个整数拥有大于等于 p 的公共质因数,那么把它们所在的集合合并。重复如上操作,直到没有可以合并的集合为止。现在 Caima 想知道,最后有多少个集合。

2020-09-29 13:22:29 755

原创 AtCoder题解——ACL Beginner Contest——C - Connect Cities

题目相关题目链接AtCoder ACL Beginner Contest C题,https://atcoder.jp/contests/abl/tasks/abl_c。Problem StatementThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City Ai and City Bi.Snuke can perform

2020-09-28 15:58:23 487

原创 并查集——(三)C++ 使用 STL 的 map 实现查并集功能

综述我们接上一节,https://blog.csdn.net/justidle/article/details/108846236,继续讨论并查集问题。我们发现使用 C++ 数组实现并查集主要问题有以下几个:1、元素中不能支持负数。因为 C++ 规定数组的下标不能是负数。2、代码量相对比较大。实现并查集代码量相对有点大。使用 map 实现并查集我们可以使用 STL 的 map 这个数据结构来实现。map 本生就是两个数据的映射关系,天生就具有并查集的特点。而且 map 可以支持负数。

2020-09-28 14:20:19 3130

原创 并查集——(二)C++ 使用数组实现查并集功能

使用限制使用数组表示查并集只能表示非负数。因为 C++ 规定数组的下标不能小于零。数据定义我们要根据题目的数据大小进行定义数组的大小。这里我们使用 0 ~ 1e5 的范围。const int MAXN=1e5+4;int parent[MAXN];初始化主要目的是将 parent 数组的值初始化为 -1,表示每个元素的父节点为自己。void init() { memset(parent, -1, sizeof(parent);}查询查询元素 x 的父节点序

2020-09-28 11:49:29 1213

原创 并查集——(一)概述

并查集概念在计算机科学中,并查集是一种树型的数据结构,用于处理一些不交集(Disjoint Sets)的合并及查询问题。并查集数据结构表示常用的并查集实现有两种方法。使用数组我们使用数组来表示这样的数据结构。比如,我们知道这个集合最大元素个数为 10^5 个,也就是 1 ~ 10^5。那么我们可以定义一个数组来记录每个元素的父节点。const int MAXN=1e5+4;int parent[MAXN];memset(parent, -1, sizeof(parent))

2020-09-28 11:11:51 380

原创 VSCode 小技巧:创建 OI 的 C++ 代码模板

为了快速书写 C++ 程序,其实还是为了偷懒,我们可以使用 VSCode 的 Template 功能,创建一个 c++ 模板代码。建立 C++ 模板第一步"File" -> "Preference" -> "User snippets"。将出现如下图所示的情况。第二步选择了 User Snippets 后,在输入框中输入 c++。如下图,VSCode 就会创建一个 cpp.json 文件。第三步将在 cpp.json 中写入自己的 cpp 文件模板,并保存即可

2020-09-26 14:04:04 3870

原创 ModuleNotFoundError: No module named ‘numpy‘ 解决方案

问题描述今天做 NLA 的作业,需要使用 gaussian elimination,不是特别想用 C++ 来完成,主要是太麻烦。于是就准备使用自己贫瘠的 Python 来完成。啪啦啪啦打了一堆代码,然后在 VSCode 上运行。我去,什么反馈都没有。蒙了,缓了一口气,让我懵逼的大脑休息一下。切换到 Terminal 来调试。前面先是 print 的几个语法错误,轻松解决。File "gaussian_elim.py", line 23 print A ^Syn

2020-09-25 11:09:32 10434

原创 Ubuntu18.04 安装 Lapack 库

环境Win10下 WSL2 的 Ubuntu 18.04,gcc、g++ 版本为最新的 7.5。依赖库至少需要 gfortran、cmake。其他不能确定。gfortranfortran 语言编译器。$ sudo apt install gfortrancmake$ sudo apt install cmake编译安装 lapack获取最新版本可以在官网(http://www.netlib.org/lapack/)、Github(https://github.

2020-09-24 14:16:36 8028 2

原创 Git 命令行使用

说明这个系列将记录自己科研搬砖过程中的点点滴滴。由于有些代码比较目前还属于特殊情况,不会在记录中明确特别的细节。这是科研搬砖笔记的第三个。环境由于全面回到了 Ubuntu,而且是字符终端的 Ubuntu。特别怀念心爱的 Win10 图形界面,时空感觉回到了 20 年前自己还是一个码农的环境,甚是念想。场景是回来了,可是人老了 20 岁,已经白发。本人有几个工作环境,实验室一台 Win10 机器(上面安装 WSL2 的 Ubuntu18.04),自己有一个 MacBookPro。...

2020-09-24 12:07:00 1303

原创 在 Win10 生成 RSA 公钥并上传到 Gitblit 中

前提记录科学搬砖的第二步。由于科学搬砖的需要,使用了实验室私有的 Gitblit 作为代码服务器,要求使用 SSH RSA 免密钥登录。工作环境Win10 机器一台,使用 WSL2 安装了 Ubuntu18.04。不想安装双系统和虚拟机,就偷懒,顺带测试一下 WSL2 到底香不香。安装 Git其实我已经安装好了 Git,只是假装自己没有安装过。Win10 下安装直接到这里下载可执行文件,安装即可,https://www.git-scm.com/。Ubuntu 下安装$

2020-09-23 22:18:27 2281 1

原创 WSL2 的 Ubuntu 编译和安装 boost

系统环境开始正式的科研搬砖。今天在新机器上安装 boost,环境为 Win10 下的 WSL2,Ubuntu 版本 18.04,boost 版本为 1.74.0。编译安装 boost更新系统老样子,先将系统更新到最新,免得出错。$ sudo apt update$ sudo apt upgrade安装依赖库boost 的依赖库主要有四个:MPI 库(mpi-default-dev)、正则表达式的UNICODE字符集(libicu-dev)和 bzlib(libbz2)。

2020-09-23 21:37:12 1956

原创 AtCoder题解——Beginner Contest 179——E - Sequence Sum

题目相关题目链接AtCoder Beginner Contest 179 E 题,https://atcoder.jp/contests/abc179/tasks/abc179_e。Problem StatementLet us denote by f(x,m) the remainder of the Euclidean division of x by m.Let A be the sequence that is defined by the initial value A1=X

2020-09-20 20:19:44 515

原创 AtCoder题解——Beginner Contest 179——D - Leaping Tak

题目相关题目链接AtCoder Beginner Contest 179 D题,https://atcoder.jp/contests/abc179/tasks/abc179_d。Problem StatementThere areNcells arranged in a row, numbered1,2,…,N from left to right.Tak lives in these cells and is currently on Cell1. He is trying...

2020-09-20 14:48:06 510

原创 AtCoder题解——Beginner Contest 179——C - A x B + C

题目相关题目链接AtCoder Beginner Contest 179 C 题,https://atcoder.jp/contests/abc179/tasks/abc179_c。Problem StatementGiven is a positive integerN. How many tuples(A,B,C) of positive integers satisfyA×B+C=N.InputInput is given from Standard Input in t...

2020-09-20 09:44:08 719

原创 AtCoder题解——Beginner Contest 179——B - Go to Jail

题目相关题目链接AtCoder Beginner Contest 179 B题,https://atcoder.jp/contests/abc179/tasks/abc179_b。Problem StatementTak performed the following actionNNtimes: rolling two dice. The result of theii-th roll isand.Check if doublets occurred at least t...

2020-09-20 09:06:12 447

原创 第一次升级内核,从 Ubuntu 16.04 升级到 Ubuntu 18.04

到了澳门大学后,再次沦落为小组的网管,能者多劳吗?其实是第一次升级内核,所以特别记录一下。过程网络上找的信息是,就以下几步:1. sudo apt update (更新软件源)2. sudo apt upgrade (更新内核相关的包)3. sudo apt dist-upgrade4. sudo apt-get autoremove5. sudo apt install update-manager-core6. sudo do-release-upgrade后面验证确实就是

2020-09-18 14:53:48 1026

原创 AtCoder题解——Beginner Contest 178——F - Contrast

题目相关题目链接AtCoder Beginner Contest 178 F 题,https://atcoder.jp/contests/abc178/tasks/abc178_f。Problem StatementGiven are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the te

2020-09-18 11:56:26 626

原创 AtCoder题解——Beginner Contest 178——E - Dist Max

题目相关题目链接AtCoder Beginner Contest 178 E 题,https://atcoder.jp/contests/abc178/tasks/abc178_e。Problem StatementThere are N points on the 2D plane, i-th of which is located on (xi,yi). There can be multiple points that share the same coordinate. What i

2020-09-15 13:02:33 453

原创 AtCoder题解——Beginner Contest 178——D - Redistribution

题目相关题目链接AtCoder Beginner Contest 178 D 题,https://atcoder.jp/contests/abc178/tasks/abc178_d。Problem StatementGiven is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to

2020-09-14 22:40:44 257

原创 AtCoder题解——Beginner Contest 178——C - Ubiquity

题目相关题目链接AtCoder Beginner Contest 178 C 题,https://atcoder.jp/contests/abc178/tasks/abc178_c。Problem StatementHow many integer sequences A1,A2,…,AN of length N satisfy all of the following conditions?0 ≤ Ai ≤ 9 There exists some i such that Ai=0 h

2020-09-14 14:42:30 738

原创 AtCoder题解——Beginner Contest 178——B - Product Max

题目相关题目链接AtCoder Beginner Contest 177 B题,https://atcoder.jp/contests/abc178/tasks/abc178_b。Problem StatementGiven are integers a,b,c and d. If x and y are integers and a≤x≤b and c≤y≤d hold, what is the maximum possible value of x×y?InputInput i.

2020-09-14 12:58:54 309

原创 Win10 WSL2 Ubuntu18.04 发生 Segmentation fault 后,如何调试

问题由来今天某个同学问我,说自己写了一个很长的代码,使用 -O0 编译的时候没有问题,使用 -O2 编译,就会产生 Segmentation fault,然后程序就结束了,百思不得其解。这个问题很简单:1、使用 -O0 的编译的时候,系统是不会优化代码的。2、使用 -O2 的编译的时候,系统是会优化代码的。3、这个问题产生的原因大概率是以下几个可能:非法指针、数组访问越界、类构造函数等。那么如何如何定位问题呢?其实 Linux 下有强大的 gdb,加上代码 Segmentation

2020-09-08 16:09:13 4209 1

原创 Win10 安装 wsl2

才拿到一个崭新的 Win10 裸机,就是仅仅安装了 Win10 系统,由于工作需要 Ubuntu,但是暂时不想安装虚拟机,所以尝试安装 WSL2,看看到底想不想。整个完整的安装过程,参考的微软的文档。https://docs.microsoft.com/zh-cn/windows/wsl/install-win10。升级 Win10 系统按照要求,请先升级到 Win10 1903 以后的版本。我升级后的版本如下。使用 PowerShell 安装 WSL1、使用管理员身份运行 Powe

2020-09-08 15:42:39 1490

原创 Mac OS 产生 Coredump,定位 Segmentation Fault

前期工作开启 Mac Coredump% sudo sysctl kern.coredump=1kern.coredump: 1 -> 1设置 /cores 目录属性$ sudo mkdir /cores $ sudo chown root:admin /cores $ sudo chmod 1775 /cores$ sudo chmod o+w /cores设置 core 文件大小$ ulimit -c unlimited定位 Segmentation F

2020-09-08 00:31:56 5201 1

原创 brew update 错误解决。git: ‘credential-osxkeychain‘ is not a git command.

问题今天想升级一下 MBP 的系统,使用命令如下brew update git: 'credential-osxkeychain' is not a git command. See 'git --help'.git: 'credential-osxkeychain' is not a git command. See 'git --help'.fatal: could not read Username for 'https://github.com':

2020-09-07 17:15:47 3695

原创 洛谷题解——P1036 选数

题目相关题目链接洛谷,https://www.luogu.com.cn/problem/P1036。题目描述已知n个整数 x1​,x2​,…,xn​,以及1个整数k(k<n)。从n个整数中任选k个整数相加,可分别得到一系列的和。例如当n=4,k=3,4个整数分别为3,7,12,19时,可得全部的组合与它们的和为:3+7+12=223+7+19=297+12+19=383+12+19=34现在,要求你计算出和为素数共有多少种。例如上例,只有一种的和为素数:3+..

2020-09-05 23:21:54 1024

原创 Ubuntu更新源切换为香港中文大学

目前在澳门大学,Ubuntu缺省源为 ubuntu.com,速度比较慢,所以切换到香港中文大学。sudo vim /etc/apt/sources.list在 sources.list 中增加以下内容即可。deb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty main restricted universe multiversedeb http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-secur

2020-09-04 15:53:05 3464 1

Algorithms Illuminated Part 3.pdf

Algorithms Illuminated Part 3.pdf

2021-03-23

Algorithms Illuminated Part 2.pdf

Algorithms Illuminated Part 2.pdf

2021-03-23

Competitive Programming 3 The New Lower Bound of Programming Contests

Competitive Programming 3 The New Lower Bound of Programming Contests

2021-03-23

浙江电网电气主接线的计算机图文规范

浙江电网电气主接线的计算机图文规范.pdf

2013-03-23

空空如也

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

TA关注的人

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