题意:给你一个字符串,要你构建一个a-z字符串,要求给你的字符串相邻的两个字符在你构建的字符串也相邻。 思路:一个思维模拟题,首先我们可以想到没出现过的我就按顺序输出即可,然后我们可以想到用一个二维数组,或者结构体,我们知道,char类型本来就是个值,我的代码用的二维数组b,b[i][0]的值代表i ...
分类:
其他好文 时间:
2020-02-17 16:05:49
阅读次数:
60
链表一般分为两种:1)单链表 2)双链表,二者是及其相似的,但双链表有两个指针 1.单链表: //数组模拟链表(快) #include <iostream> #include <cstdio> #include <cstring> #include <string.h> #include <math ...
分类:
其他好文 时间:
2020-02-17 16:04:37
阅读次数:
81
Front Push Relabel Algorithm 接口定义 Input:容量数组 ,大小为 ;源点 ,汇点 ; Output:最大流 ; 算法描述 数据结构 :n n的二维数组,表示结点间的流量, 非零当且仅当 非零。 :n维数组,表示结点的溢出流量。 :n维数组,表示结点的高度。 :除去源 ...
分类:
编程语言 时间:
2020-02-17 12:47:54
阅读次数:
93
B The Captain 给定平面上的n个点,定义(x1,y1)到(x2,y2)的费用为min(|x1 x2|,|y1 y2|),求从1号点走到n号点的最小费用。 Input 第一行包含一个正整数n(2 include include include define N 200010 define ...
分类:
其他好文 时间:
2020-02-17 12:46:21
阅读次数:
86
题目链接: https://www.acwing.com/problem/content/1272/ 题解: 线段树模板题,单点求和、区间查询都可 AC代码: #include <cstdio> #include <iostream> #include <algorithm> #include <c ...
分类:
其他好文 时间:
2020-02-16 22:21:04
阅读次数:
69
测试 // https://dsa.cs.tsinghua.edu.cn/oj/problem.shtml?id=1144 include "cstdio" using namespace std; const int SZ = 1 1; mergeSortX(lo, mi); mergeSortX ...
分类:
其他好文 时间:
2020-02-16 20:46:55
阅读次数:
91
实现思想: 1.寻找[i, n)区间里的最小值min ( i>= 0 ) 2.交换min和第i的数 ( i>= 0 ) #include <iostream> #include <algorithm> using namespace std; void selectionSort(int arr[] ...
分类:
编程语言 时间:
2020-02-16 20:36:25
阅读次数:
76
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 1e5+10;int fa[maxn];struct Edge{ int from; int to; int w;}edg ...
分类:
其他好文 时间:
2020-02-16 20:35:08
阅读次数:
75
C. Yet Another Walking Robot 每次把走到的点记录下来,如果后续出现了一个点在之前已经出现过了,那么肯定出现了重复走。另外维护下 r-l 要尽可能小 #include <iostream> #include <algorithm> #include <string> #in ...
分类:
其他好文 时间:
2020-02-16 17:58:52
阅读次数:
86
【题目描述】 排列与组合是常用的数学方法,其中组合就是从n个元素中抽出r个元素(不分顺序且r≤n),我们可以简单地将n个元素理解为自然数1,2,…,n,从中任取r个数。 现要求你用递归的方法输出所有组合。 例如n=5,r=3,所有组合为: 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 ...
分类:
其他好文 时间:
2020-02-15 23:35:41
阅读次数:
79