自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 畅通工程问题

CodeUP题目地址#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>#include <vector>#include <

2019-03-17 22:06:17 380

原创 CodeUP问题 A: 算法9-9~9-12:平衡二叉树的基本操作

CodeUp链接#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>#include <vector>#include <se

2019-03-16 17:22:25 249

原创 PAT1066 Root of AVL平衡二叉树的插入

#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>#include <vector>#include <set>

2019-03-16 16:34:17 144

原创 合并果子(优先队列的使用)

codeup网址#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>#include <vector>#include <se

2019-03-16 13:41:48 178

原创 BST的插入和遍历 PAT1043

typedef struct node { int data; node* left; node* right; //newnode(int n)}node;node* newnode(int n){ node* Node = new node; Node->data = n; Node->left = Node->right = NULL; return ...

2019-03-16 10:57:40 122

原创 迪杰斯塔拉单源最短路径算法

#include<stdio.h>#include<iostream>#include<string>#include<string.h>#include <algorithm>#include <vector>using namespace std;typedef struct node { int v;//...

2019-03-16 09:20:33 248

原创 问题 F: 【递归入门】走迷宫

题目网址typedef struct loc { int x; int y; loc(int x,int y) { this->x = x; this->y = y; } loc() { }};const int maxn = 20;int n, m, count1 = 0;int a[maxn][maxn] = {0};vector<pair&l...

2019-03-12 15:50:47 537

原创 算法笔记 【递归入门】组合的输出

codeup题目网址#include <stdio.h>const int maxn = 22;int n,r;int p[maxn];int hashtable[maxn] = { false };void DFS(int index,int nowK)//index表示正在处理的节点,nowK表示已有节点个数{ if (nowK==r)//递归边界为:当现有节点个数...

2019-03-11 20:12:26 313

原创 全排列

题目网址#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>using namespace std;const int maxn = 11;int n...

2019-03-11 19:18:56 85

原创 19PAT模拟赛(4)图的 极大匹配

Case Time Limit: 500 MS (Others) / 1000 MS (Java) Case Memory Limit: 256 MB (Others) / 512 MB (Java)Accepted: 115 Total Submission: 334查看我的提交Problem Description对给定的无向图G=(V,E),如果边集E’满足:(...

2019-03-10 22:26:04 566

转载 判断给定的顶点是否是给定无向图的【割点】

割点的定义是,如果删除该顶点后会使该无向图的连通分量(连通块)个数变多,那么就称该顶点为该无向图的割点。求无向图的连通块个数的基本思路是,开一个 vis 数组表示顶点是否已访问,然后遍历所有顶点,如果当前顶点还没有被访问,那么就访问该顶点所在的连通块,将该连通块中的所有顶点都标记为已访问。而遍历连通块也只需要一个简单的 DFS 就能解决,书上 10.3 图的遍历这个小节已经写得很清楚了。...

2019-03-10 16:05:40 1345

原创 斐波那契字符串问题(找仙书)

Goran希望在仙界图书馆借一本书。这本书在仙界图书馆分为了两版发行,分别是a版和b版。这本书非常热门,图书馆的存量也非常大,并且摆放时也有规律:第0号书柜放的是a版,第1号书柜放的是b版,对于第k(k>1)个柜子,书的摆放方式就是重复将它前边两个书柜的排放方式,例如前几个书柜的顺序为:a,b,ab,bab,abbab,bababbab,abbabbababbab,…当Goran在第N号书...

2019-03-10 15:53:22 1003

原创 采仙草(01背包问题)

#include <stdio.h>#include<iostream>#include <string.h>#include <string>#include <algorithm>#include <map>using namespace std;const int maxn = 11;const int ...

2019-03-10 15:31:38 99

原创 输出不大于N的375数字的个数

仙丹的炼制过程非常耗时,每颗仙丹在炼丹炉里需要积累一定的仙气值才能炼制成功。仙丹从放入炼丹炉开始,每一秒都会使“元神值”增加1,当仙丹的元神值十进制的各位数字仅有7,5,3,并且这三个数字都出现的时候,会使仙丹的“仙气值”增加1。现在Bruno想知道炼制的仙丹积累了多少仙气值,请你帮助Bruno计算一下。Input输入只有一个整数T,表示Bruno的仙丹已经炼制了T秒1≤T≤109Ou...

2019-03-10 15:29:59 243

原创 浙大PAT19模拟赛 稳定婚姻问题

稳定婚姻问题Case Time Limit: 200 MS (Others) / 400 MS (Java) Case Memory Limit: 256 MB (Others) / 512 MB (Java)Accepted: 90 Total Submission: 324查看我的提交Problem Description有两个点集V1和V2,点集中的顶点个数均...

2019-03-08 22:10:51 104

原创 浙大PAT 宇宙树(有瑕疵)

题目网址#include <stdio.h>#include <string.h>#include <string>#include <algorithm>#include <map>using namespace std;#include <vector>#include <set>typede

2019-03-08 16:57:50 110

原创 16浙大模拟赛 上帝的视角(树的问题)

题目网址#include <stdio.h>#include <string.h>#include <string>#include <algorithm>#include <set>#include <queue>using namespace std;const int maxn = 31;int n,n...

2019-03-08 10:39:44 102

原创 Pat 1075 Pat Judge

1075 PAT Judge (25 分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification...

2019-03-04 19:41:00 132

原创 大整数的加法 codeup加法器

题目链接问题 A: a+b时间限制: 1 Sec 内存限制: 32 MB提交: 430 解决: 181[提交][状态][讨论版][命题人:外部导入]题目描述实现一个加法器,使其能够输出a+b的值。输入输入包括两个数a和b,其中a和b的位数不超过1000位。输出可能有多组测试数据,对于每组数据,输出a+b的值。样例输入6 82000000000 30000000000...

2019-03-04 10:35:22 140

原创 PAT甲级1013 (BFS求图的连通分量数)

题目链接:PAT甲级1013 分析:添加的最少的路线,就是他们的连通分量数-1,因为当a个互相分立的连通分量需要变为连通图的时候,只需要添加a-1个路线,就能让他们相连。由于删除的城市单独为一个连通分量,所以就是他们的连通分量数-2,所以这道题就是求去除了某个结点之后其他的图所拥有的连通分量数cnt。#include <stdio.h>#include <string.h&...

2019-03-03 19:30:19 428

原创 pat 1007 最大连续子序列 动态规划

const int maxn = 10000;int a[maxn],dp[maxn],length[maxn];int main(){ int n; while(scanf("%d",&n),n!=0) { bool flag = true; for (int i = 0; i < n; i++) scanf("%d", &a[i]); dp...

2019-03-02 10:34:16 88

原创 递归(全排列)解决8皇后问题

#include <iostream>const int maxn = 100;int p[maxn], value[8] = {1,2,3,4,5,6,7,8};string result[100];int count1 = 0,k=0;bool hashtable[maxn] = { false };void Pgenerate(int index){ if (i...

2019-03-01 20:50:22 129

原创 codeup 2044 神奇的口袋(递归解决)

2044: 神奇的口袋时间限制: 1 Sec 内存限制: 32 MB提交: 677 解决: 314[提交][状态][讨论版][命题人:外部导入]题目描述有一个神奇的口袋,总的容积是40,用这个口袋可以变出一些物品,这些物品的总体积必须是40。John现在有n个想要得到的物品,每个物品的体积分别是a1,a2……an。John可以从这些物品中选择一些,如果选出的物体的总体积是40,那么利...

2019-03-01 20:48:54 180

原创 01背包问题

#include <stdio.h>#include <string.h>#include <string>#include <algorithm>#include <map>using namespace std;const int maxn = 100;const int maxm = 100;int main(){...

2019-03-01 20:46:45 109

原创 codeup求中位数2069

网址:http://codeup.cn/problem.php?id=2069&csrf=MokTQmyE501Xx2p5cFxDFnl5rda8JrBY题目描述中位数定义:一组数据按从小到大的顺序依次排列,处在中间位置的一个数(或最中间两个数据的平均数).给出一组无序整数,求出中位数,如果求最中间两个数的平均数,向下取整即可(不需要使用浮点数)输入该程序包含多组测试数据,每一组...

2019-03-01 20:35:23 89

原创 C++ 递归求字符数组的幂集(全部子集)

集合S的幂集 P(S) 是S所有的子集. 例如 S = {a, b, c} 则它的幂集就是 P(s) = {{}, {a}, {b}, {c}, {a,b}, {a, c}, {b, c}, {a, b, c}}. 其中{}表示空集.#include <stdio.h>#include <string.h>#include <string>#includ...

2019-03-01 20:29:18 1923

原创 codeup求素数

网址:http://codeup.cn/problem.php?cid=100000591&pid=0问题 A: 素数时间限制: 1 Sec 内存限制: 32 MB提交: 508 解决: 181[提交][状态][讨论版][命题人:外部导入]题目描述输入一个整数n(2<=n<=10000),要求输出所有从1到这个整数之间(不包括1和这个整数)个位为1的素数,如果没...

2019-03-01 10:13:46 160

原创 算法笔记 Codeup最长回文子串

问题 A: 【字符串】最长回文子串时间限制: 1 Sec 内存限制: 128 MB提交: 192 解决: 92[提交][状态][讨论版][命题人:外部导入]题目描述输入一个字符串,求出其中最长的回文子串。子串的含义是:在原串中连续出现的字符串片段。回文的含义是:正着看和倒着看相同。如abba和yyxyy。在判断回文时,应该忽略所有标点符号和空格,且忽略大小写,但输出应保持原样(在回文...

2019-02-28 13:46:09 185

空空如也

空空如也

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

TA关注的人

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