自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

大梁的博客

求知若渴,虚怀若愚。

  • 博客(15)
  • 收藏
  • 关注

原创 AlphaVantage获取股票数据并保存为csv

import pandas as pdfrom alpha_vantage.timeseries import TimeSerieskey请到官网免费申请,需要科学上网ts = TimeSeries(key=’’, output_format=‘pandas’)data, meta_data = ts.get_intraday(symbol=‘MSFT’,interval=‘1min’, ...

2019-10-11 09:23:27 1597

原创 DP最长公共子序列

//最长公共子序列//ab34c//a1bc2#include <iostream>#include <string>using namespace std;int max(int a, int b){ if (a > b) { return a; } return b;}string dp(string str1, string ...

2019-05-21 21:58:50 142

原创 DFS最长公共子序列

//最长公共子序列//a123b4c//1234abc#include <iostream>#include <string>using namespace std;string dfs(string str1,string str2){ int len1=str1.length(); int len2=str2.length(); stri...

2019-05-21 11:49:46 300

原创 //在数字等边三角形中寻找一条从顶部到底边的路径,使得路径上所经过的数字之和最大,路径上的每一步都只能往右下或左下走,只需求出最大和即可,不必给出具体路径

// 7// 3 8// 8 1 0// 2 7 4 4//4 5 2 6 5 #include <iostream>using namespace std;int max(int a,int b){ if(a>b) { return a; } return b;}int dp(int **arr,int n){ if(!(n...

2019-05-20 17:15:49 2253

原创 DP钢条切割问题:将长为n的钢条,切割成m段,不同长度的钢条市场价格不同,切割本身没有成本,求最大价值的切割方案

//长度1,2,3,4,5,6,7,8,9,10//价格1,5,8,16,10,17,17,20,24,30 //n为钢条长度,m为可切割的数据组数 //输入示例:10 10 1 5 8 16 10 17 17 20 24 30 //结果:37#include <iostream>#include <vector>using namespace std;i...

2019-05-20 11:12:55 1152

原创 dp背包问题:将n个物品放进背包里,背包容量为m,物品具有重量和价值两个属性,要求背包所放物品的价值最大,物品不可被切割

//将n个物品放进背包里,背包容量为m,物品具有重量和价值两个属性,要求背包所放物品的价值最大,物品不可被切割//举例:4个物品,背包容量为5,每个物品属性(2,3) (1,2)(3,4)(2,2)//输入示例:4 5 2 3 1 2 3 4 2 2//输出结果为7 #include <iostream>#include <vector>using names...

2019-05-19 16:00:26 4168

原创 水洼问题:一个水坑附近如果存在另一个水坑则视为连接在一起,视做一个水洼,附近指的是八连通,给定一个地图,问有多少个水洼及水洼的大小

#include <iostream>#include <string>#include <queue>using namespace std;//水洼问题,八连通的积水被认为是连在一起的,构成一个水洼,问有多少个水洼struct point{ int x; int y; int counts;};queue<point> s...

2019-05-14 20:09:49 943

原创 括号组合问题:有n个括号,请问有多少种合理的组合方式?

#include <set>#include <iostream>#include <string>using namespace std; set<string> func(int n) { set<string> s_n; if(n==1) { s_n.insert("()"); retu...

2019-05-14 17:56:04 1872

原创 上台阶问题:一个人上台阶,一次可以走1、2、3步,问n个台阶有多少种走法?

#include <iostream>using namespace std;int func(int a){ if (a==1 || a==0) { return 1; } if (a<1) { return 0; } if (a==2) { return 2; } return func(a - 1) + func(a - 2) + f...

2019-05-14 17:52:46 5527 1

原创 非数值型集合的任意子集

#include <iostream>#include <set>#include <string>using namespace std;set<string> func(string arr[],int n){ set<string> s; s.insert(""); for(int i=0;i<n;i++)...

2019-05-14 17:48:53 140

原创 非数值型集合的全排列个数

#include <iostream>#include <string>#include <set>using namespace std;set<string> func(int n, string str){ set<string> s; string temp,temp2; if (n == 0) { tem...

2019-05-14 17:47:52 129

原创 给定若干个数字,每个数字至多使用一次,能否凑出某个数

#include <iostream>#include <set>using namespace std;//1,2,4,7能否凑13void func(int num,int arr[4],int i,set<int> noumber){ if (num==13) { for (set<int>::iterator it=noum...

2019-05-14 17:45:09 1093

原创 C++,DFS深度优先,数独游戏

#include <iostream>using namespace std;bool res(int arr[][9], int x, int y, int n){ //行列有无重复 for (int i = 0; i < 9; i++) { if (arr[x][i]==n) { return false; } if (arr[i][y] ...

2019-05-13 22:30:56 491

原创 bfs广度优先迷宫,最短路径

//只能判断能不能走通,不能得到路径#include #include using namespace std;struct point{int x, y, dis;};int fx[4] = { 1,-1,0,0 },fy[4] = { 0,0,1,-1 };int bfs(int x, int y, int a, int b, int maze[][9]){queue m...

2019-04-15 15:52:21 334

原创 求最大公约数、最小公倍数

最大公约数:辗转相除法int func(int a, int b){ if(a==0) { return 0; } return func(b,a%b);}最小公倍数:两个数的乘积 是 最小公倍数和最大公约数的乘积...

2019-04-01 18:09:48 88

空空如也

空空如也

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

TA关注的人

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