自定义博客皮肤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)
  • 收藏
  • 关注

原创 1046 Shortest Distance

//// Created by CyIce on 2021/2/25.//#include <stdio.h>#include <algorithm>using namespace std;const int MAXN = 100010;// 记录节点1到节点i的距离,固定一个方向int dis[MAXN] = {0};int total = 0;int distance(int a, int b) { if (a > b) swap(a,

2021-02-25 16:05:33 89 1

原创 1042 Shuffling Machine

//// Created by CyIce on 2021/2/25.//#include <stdio.h>#include <algorithm>using namespace std;struct poker { char type; int num; int order;} pokers[54]p;int order[54];void printPoker(poker p) { printf("%c%d", p.ty

2021-02-25 10:41:34 79

原创 1001 A+B Format

//// Created by CyIce on 2021/2/25.//#include <stdio.h>#include <stack>using namespace std;stack<int> S;void toString(int n) { int temp = n < 0 ? -n : n; if (n == 0) S.push(0); while (temp > 0) { S.pus

2021-02-25 10:14:45 86

原创 1057 Stack

分析由于题目规定每个元素为105以内的正整数,所以可以使用分块的思想储存数据//// Created by CyIce on 2021/2/24.//#include <stdio.h>#include <stack>#include <algorithm>#include <cstring>using namespace std;const int MAXN = 100010;const int SQRTN = 316;int

2021-02-24 14:58:22 75

原创 问题 A: 装箱问题

//问题 A: 装箱问题#include <stdio.h>#include <algorithm>using namespace std;const int MAXV = 20010;int dp[MAXV], V[MAXV];int main() { int n, capcity, ans = 0x7777777; scanf("%d%d", &capcity, &n); fill(dp, dp + MAXV, ca

2021-02-07 11:02:40 149

原创 问题 A: 【字符串】最长回文子串

分析由于可能存在多个最长的回文串,此时要求输出最左边的回文串,为了方便,字符串从后往前遍历,保证最后的结果一定是最左边的子串。//最长回文子串#include <stdio.h>#include <iostream>#include <cstring>using namespace std;const int MAXN = 5010;int dp[MAXN][MAXN] = {0};int m[MAXN];int main() { c

2021-02-04 10:47:37 75

原创 问题 A: 最长公共子序列

//// Created by CyIce on 2021/2/1.////最长公共子序列#include <iostream>#include <algorithm>#include <string>#include <stdio.h>using namespace std;const int MAXN = 110;//将A下标为i,B下标为j的状态保存在dp[i+1][j+1]中,便于定义边界dp[0][i]和dp[i][0]

2021-02-01 10:00:15 81

原创 问题 A: 最长上升子序列

//最长上升子序列#include <stdio.h>#include <algorithm>using namespace std;const int MAXN = 1010;int A[MAXN], dp[MAXN];int main() { int n, ans = 1; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%d", &A[

2021-01-31 08:48:43 64

原创 问题 A: 最大连续子序列

//// Created by CyIce on 2021/1/30.////最大连续子序列和#include <stdio.h>const int MAXN = 10010;int N, A[MAXN], dp[MAXN], S[MAXN];int main() { int index; scanf("%d", &N); while (N != 0) { for (int i = 0; i < N; ++i) {

2021-01-30 10:54:26 68

原创 最大连续子序列和

//// Created by CyIce on 2021/1/30.////最大连续子序列和#include <stdio.h>#include <algorithm>using namespace std;const int MAXN = 100000;int N,A[MAXN],dp[MAXN]={0};int main(){ int ans; scanf("%d",&N); for (int i = 0; i &lt

2021-01-30 10:22:30 76

原创 问题 A: Fibonacci

//// Created by CyIce on 2021/1/30.//#include <stdio.h>const int MAXN = 40;int f[MAXN] = {0};int fibonacci(int n){ if(n==0) return 0; if(n==1) return 1; if(f[n]==0) f[n] = fibonacci(n-1)+fibonacci(n-2); return f[n];}

2021-01-30 10:04:54 68

原创 1030 Travel Plan C++

#include <stdio.h>#include <algorithm>#include <queue>using namespace std;const int MAXV = 510;int Distance[MAXV][MAXV], Cost[MAXV][MAXV];int N, S, D, INF = 0x3fffffff, cost[MAXV], d[MAXV];int pre[MAXV];queue<int> q;bool

2021-01-20 12:09:20 181

原创 1003 Emergency C++

1003 Emergency C++分析使用Dijkstra算法即可代码#include <stdio.h>#include <algorithm>using namespace std;const int MAXV = 510;const int INF = 0x3fffffff;//Team:每个城市的救援队数量int n, G[MAXV][MAXV], Team[MAXV], pathNum = 0, teamNum = 0;// d[i]:起点到i

2021-01-19 14:38:28 179

原创 1043 Is It a Binary Search Tree C++

分析以二叉排序树的前序序列为输入序列,重新构成的二叉排序树和原二叉排序树相同,因此,判断输入序列的是否是某一颗二叉排序树的前序序列,只需要判断用输入序列构成的二叉排序树的前序序列是否和输入序列相同即可。//// Created by CyIce on 2021/1/12.//#include <stdio.h>#include <vector>using namespace std;const int MAXN = 1000;int N, inputList[M

2021-01-18 10:20:29 91

原创 1076 Forwards on Weibo (30分) C++

比较直接的一道题,注意存储数组G时要反向存储即可。#include <stdio.h>#include <queue>using namespace std;//储存节点和当前层数信息struct node { int v, layout;};const int MAXN = 1010;int N, L, G[MAXN][MAXN] = {0};int BFS(node Node) { int ans = 0; queue<no

2021-01-18 09:58:02 49

原创 C++实现计算数组逆序对数目

C++实现计算数组逆序对数目用到的工具函数 计算数组的长度template&lt;class T&gt;int length(T &amp;arr) { return sizeof(arr) / sizeof(arr[0]);}计算逆序对函数void count(int *arr, int l, int m, int r, int &amp;n...

2018-09-07 17:44:48 2413

原创 C++实现冒泡排序

C++实现冒泡排序用到的工具函数 计算数组的长度template&lt;class T&gt;int length(T &amp;arr) { return sizeof(arr) / sizeof(arr[0]);} 交换两个变量的值template&lt;class T&gt;void swap(T *a, T *b) { T ...

2018-09-07 16:05:41 1341

原创 C++实现归并排序

C++实现归并排序用到的工具函数 计算数组的长度template&lt;class T&gt;int length(T &amp;arr) { return sizeof(arr) / sizeof(arr[0]);}归并排序函数 合并两个已经排好序的数组#include &lt;climits&gt;void merge(int ...

2018-09-06 18:44:55 430

原创 C++实现选择算法

C++实现选择算法用到的工具函数 计算数组的长度template&lt;class T&gt;int length(T &amp;arr) { return sizeof(arr) / sizeof(arr[0]);} 交换两个变量的值template&lt;class T&gt;void swap(T *a, T *b) { T ...

2018-09-05 21:29:37 1539

原创 C++实现插入排序

C++实现插入排序用到的工具函数 计算数组的长度template&lt;class T&gt;int length(T &amp;arr) { return sizeof(arr) / sizeof(arr[0]);} 交换两个变量的值template&lt;class T&gt;void swap(T *a, T *b) { T tm...

2018-09-05 21:02:58 297

原创 C++模版的使用

C++模版的使用在util.h中声明并定义 声明与定义必须要在同一文件中,否则将无法编译template&lt;class T&gt;int length(T&amp; arr) { return sizeof(arr) / sizeof(arr[0]);}调用#include &lt;iostream&gt;#include "util.h"...

2018-09-05 19:53:08 94

原创 C++默认参数函数的使用

C++默认参数函数的使用声明函数 在test.h中声明默认参数函数,默认参数必须放在函数后 指针a为普通参数,order为默认参数 #include &lt;iostream&gt;void test(int *a, bool order = true);定义函数 在test.cpp中定义函数,默认的参数和普通参数一样定义...

2018-09-05 15:26:32 1485

原创 CentOS 7下部署Django项目(Python3+Django2+uginx+uWSGI)

CentOS 7下部署Django项目(Python3+Django2+uginx+uWSGI)CentOS 7下部署Django项目(Python3+Django2+uginx+uWSGI)在/data/目录下创建一个虚拟环境激活虚拟环境使用pip安装django、uwsgi和nginx创建uwsgi软链接创建一个工程目录,并创建Django项目在project/mysite...

2018-08-04 20:21:52 888

原创 Mac下使用终端操作MySQL数据库

Mac下使用终端操作MySQL数据库安装MySQL 略为mysql设置软链接 ln -s /usr/local/mysql/bin/mysql /usr/local/bin/启动MySQL 在系统偏好设置下的Mysql中启动Mysql服务登录MysQL 在终端下输入以下命令 1. mysql -u root -p 2...

2018-08-03 20:15:34 7548 1

原创 python3.x安装virtualenv管理第三方包

python3.x安装virtualenv管理第三方包python3.x安装virtualenv管理第三方包安装virtualenv创建virtualenv软链接创建一个项目目录,并创建venv激活virtualenv退出virtualenv安装virtualenvpip3 install virtualenv创建virtualenv软链接...

2018-08-03 15:12:34 756

原创 在Linux下配置Python3.6

在Linux下配置Python3.6在Linux下配置Python3.6解决python3.6的依赖问题下载python的源码包解压源码包,并将解压的文件放入/usr/local/python3 目录配置编译文件编译、安装删除Python-3.6.5文件夹创建python3和pip软连接查看是否安装完成解决python3.6的依赖问题yum gr...

2018-08-03 14:48:53 272

空空如也

空空如也

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

TA关注的人

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