自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 HDU-2072单词数

#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <string>#include <set>#include <cctype>using namespace std;int read() { char ch; ch = getchar(); if (ch == '#') retur.

2021-01-30 00:05:16 100

原创 POJ - 1011 Sticks【DFS】

这道题是一个比较经典的DFS,但是我一开始不会。。。简单来说,思路是这样的:从小到大遍历所有可能的长度,假设当前遍历到长度为i,那么就要检验这个i是否是满足条件的解,如果是,因为是从小到大遍历,所以是最小的长度,如果不是,则继续遍历。那么什么才是满足条件的解呢,要求是所有的木棒正好能组合成整数个i长度的木棒。那么怎么判断呢,使用深度优先搜索,对于给定的n个木棒,搜索一种解法能让其组合成整数个i长度的木棒。其实,这个问题的关键还是看剪枝,主要从三个方面进行剪枝(说实话我做的时候真的怎么都想不到),

2021-01-20 17:51:38 289

原创 Codeforces-377A Maze(深度优先搜索)

Codeforces-377A Maze这道题是一道比较简单的思维题,只需要使用dfs或者bfs搜索哪些块不用删除,而剩下的块则必须删除,因此我想到的解法有两种,一种是使用DFS遍历,一种是使用BFS遍历,提交的时候使用的水BFS。具体代码如下,因为代码都比较直观,不再多做解释,请见谅。#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#inclu

2021-01-12 22:51:52 208

原创 c++ 11 特性学习

auto 含义改变,现为自动类型推断register c++11之前为建议使用CPU寄存器存储变量,现在几乎没有意义

2019-10-26 16:59:05 165

原创 C++之类部分探究

#include <iostream>#include <string>using namespace std;class vclass{public: string str = "pclass"; vclass() { cout << "create vlass" << endl; } virtual ~vclass() ...

2019-10-26 13:57:45 145

原创 C++之函数处理数组和const指针

一 const 保护数组#include <iostream>using namespace std;void modify(const int a[]){ a++; //a[0] += 10;}int main(){ return 0;}二、const与指针#include <iostream>]using namespace st...

2019-10-26 12:57:35 350

原创 C++循环链表之约瑟夫环

#include <cstdio>#include <iostream>#include <cstdlib>using namespace std;struct node{ int index; node * next;};typedef node * LNode;class CLL{ public: ...

2019-10-10 21:08:03 656

原创 Shell编程之基础语法

今天在菜鸟教程上学习了一下shell编程。。。#!/bin/bash#the variety of shell#declare a varietynum=123456#use the varietyecho $num#note the border of varietyecho this is a ${num}ber#this is a readonly variety#rov...

2019-10-04 19:23:57 141

原创 C++学习之用户自定义类的强制类型转换

在C++中我们使用C++的基本类型的时候有时候会需要强制类型转换,比如说void转换为int。但是如果使我们自定义类型的怎么办,在C++我们可以通过重载operator typename()来实现。下面是代码:#include <iostream>#include <cstdio>#include <algorithm>using namespace...

2019-10-02 15:54:00 1504

原创 最小二乘法推导以及理解

我在网上发现了两种推导方式,于是自己跟着推导了一遍。。。。。(一)(高数式推导): [参考博客](https://blog.csdn.net/MarsJohn/article/details/54911788) 这里先引入两个提前推得出的结论: ![两个结论](https://img-blog.csdnimg.cn/20190907195440348.jpg?x-oss-proce...

2019-09-07 20:19:01 6903 1

原创 在Jupyter Notebook中安装python包的小技巧

import osok = Falsewhile not ok: get_ipython().system('pip install numpy')#或者os.system('pip install numpy') try: import numpy ok = True; except: continue以上两者的最直...

2019-09-07 19:31:14 1529

原创 数据结构之KMP算法实现

最近学习KMP算法,就自己实现了一下试试,因为没有完整的测试过,所以也不知道是不是完全正确,但是本地输入的几个测试样例都过了。。。。。#include <iostream>#include <cstdio>#include <string>using namespace std;void get_next(string input,int next...

2019-09-07 13:57:11 375

原创 数据结构——稀疏矩阵之快速转置算法实现

#include <iostream>#include <cstdio>#include <vector>#include <algorithm>using namespace std;template<typename D>class SMatrix{ public: struct DD//二维矩...

2019-09-06 17:51:08 1440

原创 数据结构之队列

#include <iostream>#include <cstdio>#include <stdlib.h>using namespace std;namespace Queue{ template<typename Q> class queue{ typedef Q * ptr; pu...

2019-09-04 20:38:28 99

原创 数据结构之栈

#include <iostream>#include <cstdlib>using namespace std;namespace Stack{ template<typename N> class stack { typedef N* S; private : S sk;...

2019-09-04 10:56:58 98

原创 数据结构之线性表

#ifndef _LIST_H_#define _LIST_H_#include <iostream>#include <cstdio>namespace Linear{ class FNode{ public : //virtual operator <() = 0; virtual voi...

2019-09-03 12:34:37 147

原创 C++ 复习之文件输入输出(简短)

#include <iostream>#include <algorithm>#include <fstream>#include <string>using namespace std;int main(){ ifstream fin;//输入 fin.open("002.cpp"); string line...

2019-09-02 23:28:33 130

原创 C++复习之循环和常规输入输出

#include <iostream>#include <vector>#include <string>using namespace std;int main(){ vector<int> v; v.clear(); for (int i=1;i<=8;i++) v.push_back(i); ...

2019-08-31 17:21:11 243

原创 c++ 复习之string的使用

字符串:#include <iostream>#include <cstdio>#include <string>int main(){ using namespace std; string str1 = "this is a string"; string str2("string"); cout <<...

2019-08-31 17:01:07 108

原创 Numpy学习之线性代数(持续更新)

依照Numpy官方中文文档:https://www.numpy.org.cn/reference/routines/linalg.html矩阵和矢量产品:dot(a, b[, out]) 两个数组的点积。linalg.multi_dot(arrays) 在单个函数调用中计算两个或多个数组的点积,同时自动选择最快的求值顺序。>>> a = np.random.random(...

2019-08-31 16:34:21 185

原创 Numpy进阶之Less基础

花式索引和索引技巧:>>> a = np.arange(12)**2>>> aarray([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121], dtype=int32)>>> i = np.array([1,1,3,5,8])>>> a...

2019-08-31 15:50:11 1633

原创 Numpy数组之深拷贝

我是跟着numpy官方中文文档敲的代码,官方中文文档网址为:https://www.numpy.org.cn/user_guide/quickstart_tutorial/deep_copy.htmlcopy 方法生成数组及其数据的完整拷贝。>>> d = a.copy()>>> darray([[ 0, 1, 2, 3], [ 4,...

2019-08-31 14:21:20 2906

原创 Numpy数组之浅拷贝

我是跟着numpy官方中文文档敲的代码,官方文档地址为https://www.numpy.org.cn/user_guide/quickstart_tutorial/copies_and_views.htmlnumpy数组在进行操作时,究竟何时会复制数据,何时不会,这是一个问题。这边文章通过以下三种情况来解释一下。完全不复制:简单赋值不会创建数组对象或其数据的拷贝。>>>...

2019-08-31 14:15:47 264

原创 Numpy进阶之形状操作

我是跟着numpy中文官方文档敲的代码,原文地址:https://www.numpy.org.cn/user_guide/quickstart_tutorial/shape_manipulation.html下面就开始了:改变数组形状:>>> a = np.floor(10 * np.random.random((3,4)))>>> aarray([[...

2019-08-31 14:03:47 1376

原创 Numpy库学习之基础篇

我是根据官方中文文档,跟着敲的代码,原文地址为https://www.numpy.org.cn/article/basics/an_introduction_to_scientific_python_numpy.html首先,导入库import numpy as np生成ndarray:首先,np.array()可以传递任何序列,不仅仅是listnp.linspace(start, s...

2019-08-30 23:34:10 579

原创 NumCpp的安装

最近想用一下Numpy库的c++版,但是安装比较复杂,不过还好最终安装完成了我使用的IDE是VSC++2017;下面是步骤第一步,阅读官方文档,我下载的版本需要下载Boost1.7或Boost1.68,所以我就去官网下载了Boost;第二步,下载Boost;第三步,运行新出现的b2.exe和bjam.exe;第四步,安装Boost:在解压完的文件夹里找到bootstrap.bat并运行...

2019-08-30 22:03:14 2349 1

空空如也

空空如也

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

TA关注的人

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