自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

空白

用代码填写我空白的人生

  • 博客(18)
  • 资源 (1)
  • 收藏
  • 关注

转载 邻接表模板

点这里

2017-07-27 20:29:17 365

原创 F - 二叉树的遍历

给出一棵二叉树的中序和前序遍历,输出它的后序遍历。 Input 本题有多组数据,输入处理到文件结束。每组数据的第一行包括一个整数n,表示这棵二叉树一共有n个节点。接下来的一行每行包括n个整数,表示这棵树的中序遍历。接下来的一行每行包括n个整数,表示这棵树的前序遍历。3<= n <= 100Output 每组输出包括一行,表示这棵树的后序遍历。 Sample Input 7 4 2 5 1

2017-07-25 19:06:51 303

原创 E - 确定比赛名次

有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。 Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍的个数,M表示接着有

2017-07-25 19:05:56 257

原创 D - Maze

思维搜索Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side

2017-07-25 19:04:41 380

原创 C - Prime Ring Problem

A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles should be a prime. Note: the number of firs

2017-07-25 19:03:31 188

原创 B - Catch That Cow

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,00

2017-07-25 19:02:22 189

原创 A - Oil Deposits

The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the

2017-07-25 19:01:24 223

原创 map c++

C++中map容器提供一个键值对容器,map与multimap差别仅仅在于multiple允许一个键对应多个值。 一、map的说明 1 头文件 #include <map> 2 定义 map<string, int> my_Map; 或者是typedef map<string, int> MY_MAP; MY_MAP m

2017-07-25 18:58:56 564

转载 string详解

#include <iostream>#include <string>using namespace std;int main(){ //1.string类的构造函数 string str1 = "aaaaa";//最简单的字符串初始化 cout << str1 << endl; // aaaaa char *s = "bbbbb"; string s

2017-07-22 10:41:32 185

转载 并查集

我从这里转载,那人也是转载,出处不明,请原作者见谅 并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?) 来看一个实例,杭电1232畅通工程 首先在地图上给你若干个城镇,这些城镇都可以看作点,然后告诉你哪些对城镇之间是有道路直接相连的。最后要解决的

2017-07-22 10:37:47 199

转载 vector

用法:1.文件包含: 首先在程序开头处加上#include<vector>以包含所需要的类文件vector还有一定要加上using namespace std;2.变量声明:2.1 例:声明一个int向量以替代一维的数组:vector <int> a;(等于声明了一个int数组a[],大小没有指定,可以动态的向里面添加删除)。2.2 例:用vector代替二维数组.其实只要声明一个

2017-07-21 21:39:27 183

转载 vector用法

转载 来源`转载来源在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。1 基本操作(1)头文件#include.(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout<#include<stdio.h>#include<algorithm>#include<vector>#include<

2017-07-21 21:36:03 165

原创 二分查找中的最大值的最小值问题

挑战程序设计2的 allocation#include<iostream>#include<cstdio>using namespace std;int a[100001];int k,n;int panduan(int mid){ int j=0,i; for(i=0;i<k;i++) { long long sum=0; wh

2017-07-18 20:11:38 2918

原创 E - Bad Hair Day

Some of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of o

2017-07-18 11:42:53 266

原创 D - Feel Good

Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people’s memories about some period of life. A new ide

2017-07-18 11:33:16 255

原创 C - Heap Operations

Petya has recently learned data structure named “Binary heap”.The heap he is now operating with allows the following operations:put the given number into the heap; get the value of the minimum element

2017-07-18 11:21:34 304

原创 F - The kth great number

第k大的题,此题用推排序做,故是优先队列的模板题#include<queue>#include<iostream>#include<cstdio>using namespace std;struct node{ int num; friend bool operator<(node aa,node bb) { return aa.num>bb.num

2017-07-18 11:08:44 295

原创 并查集

畅通工程简单并查集的应用,模板题#include<iostream>#include<cstdio>using namespace std;int pre[1100];int findd(int x){ int r=x; while(r!=pre[r]) { r=pre[r]; } int i=x,j; while(i!=r)

2017-07-18 11:04:10 146

彻底弄懂RTree索引

包括R树的增删改查以及固有特性,包含例子讲解

2021-03-14

空空如也

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

TA关注的人

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