- 博客(16)
- 问答 (5)
- 收藏
- 关注
原创 STL标准库函数总结
参考链接0 前言:平时STL自己用的很少,很多库函数都不是很熟悉,趁着最近有空,将STL的知识学习一下。主要学习一下,pair,vector,set,vector,stack,queue,map,string.1 pair位于头文件< iostream>中用来表示一个二元组或元素对 2.1 使用pai
2018-07-31 11:34:47 4763
原创 数据结构总结
POJ 2524 Ubiquitous Religions (并查集)//并查集 #include<bits/stdc++.h>#define inf 0x3f3f
2018-07-30 15:48:32 260
原创 CodeForces 996B World Cup (思维)
题意圆形球场有n个门,Allen想要进去看比赛。Allen采取以下方案进入球场:开始Allen站在第一个门,如果当前门前面有人Allen会花费单位时间走到下一个门,如果没人Allen从这个门就进去了。球场的每个门,每单位时间可以进去一个人。问Allen最终是从哪个门进入球场的?思路开始的时候,我直接用模拟写的,果断TLE。 TLE如下:#include<bits/std...
2018-07-31 21:45:54 183
原创 CodeForces - 982B Bus of Characters (栈+队列)
B. Bus of Characters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Bus of Characters there are n rows of seat, each havi...
2018-07-31 21:16:11 305
原创 Codeforces-985C - Liebig's Barrels (思维+贪心)
题意:输入 n k l 你要做n个桶,每个桶需要k个木板,用木板拼好的桶相互之间体积的差距&lt;=l,桶的体积大小就是最短的那根木板的长度大小。 http://codeforces.com/contest/985/problem/C#include&lt;bits/stdc++.h&gt;using namespace std;const int maxn=1e5+...
2018-07-31 20:58:54 259
原创 判断是否存在环模板(拓扑排序,Bellman_ford算法)
(一)Bellman_ford有错误,回头调:/*Bellman-ford判断是否存在负环 原理是在n-1次松弛之后,如果存在负环,那么造成点的值变小*/#include&lt;bits/stdc++.h&gt;#define inf 0x3f3f3f#define mem(x) memset(x,0,sizeof(x))#define Debug(x) cout&lt;&lt;"x...
2018-07-30 21:20:11 319
原创 CodeForces - 977E Cyclic Components(判断单环)
题意: 计算图中不公共边的环的个数//存不存在单环,不公边的环 #include<bits/stdc++.h>#define inf 0x3f3f3f3f#define maxn 300010#define sf scanf#define pf printfusing namespace std;vector <int> G[maxn];vector ...
2018-07-30 14:48:38 252
原创 最短路径模板(dijkstra,floyed)
n个点,m条边,给定起点和终点,求单源最短路径。 dijkstra算法:#include&amp;amp;amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;amp;amp;gt;#define inf 0x3f3f3f3f#define maxn 100#define sf scanf#define pf printfusing namespace std;int n,m,x,y,z; //n个城市和m条道路int mp[
2018-07-30 13:36:07 784
原创 codeforces-601A The Two Routes (Floyd)
题意: 是n个城市之间任意两个城市间要么有火车线路要么有汽车线路,要从1出发到n,而且火车和汽车不能同时到达一个城市,问两者都到达的最短时间。 分析: 肯定有一种车可以从1直接到达n,并且这样肯定是最优的判断另一种能不能到达n就行了。/*floyed算法求单源最短路径i,j,k,其中k是中间结点,i是起点,k是终点 */ #include&lt;bits/stdc++.h&gt;#...
2018-07-29 13:34:25 173
原创 CodeForces 954BString Typing(字符串循环节)
You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.Initially, you have an empty string. Until you type the whole string, you may perfo...
2018-07-26 18:26:12 441
原创 CodeForces - 988B Substrings Sort (字符串,一个字符串包含另外一个字符串)
Problem descriptionYou are given nn strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string, all strings that are placed...
2018-07-26 17:50:02 273
原创 CodeForces - 846A Curriculum Vitae(最长上升子序列)
A. Curriculum Vitae time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Hideo Kojima has just quit his job at Konami. Now he is going to find ...
2018-07-24 19:38:12 327
原创 CodeForces - 922B Magic Forest(水题)
#include&lt;bits/stdc++.h&gt;#define maxn 10010using namespace std;int n,a,b,c,k,ans;int pd(int i,int j,int k){ return i+j&gt;k ;}int main(){ ans=0; scanf("%d",&amp;n); for(int i...
2018-07-24 12:40:11 175
原创 HDU6301 Distinct Values
TLE#include&amp;lt;bits/stdc++.h&amp;gt;#define maxn 10010using namespace std;int N,n,m,k1,k2,k,tmp,t,ans;typedef struct Node{ int x,y;}node;node A[maxn];int B[maxn];bool cmp(node a,node b){ ...
2018-07-23 21:13:39 204
原创 HDU6308 Time Zone(字符串)
题意:时区划分,东八区作为标准,给定其他地区的时区,输出当地的时间。 分析: 写错了,回头改。#include&amp;lt;iostream&amp;gt;#include&amp;lt;set&amp;gt;#include&amp;lt;cstdio&amp;gt;#define maxn 10010using namespace std;int N,xx,yy;typedef stru
2018-07-23 15:28:40 272
原创 HDU6300 Triangle Partition
题意:不相交的三角形 分析:水题,从左向右扫描,坐标小的三个作为一组就可以。#include&lt;bits/stdc++.h&gt;#define maxn 10010using namespace std;typedef struct Node{ int x,y; int t;}node;int N,n;node A[maxn];bool cmp(node ...
2018-07-23 15:26:50 341
空空如也
请教一个关于网络编程中sendarp的问题?
2019-04-18
求问C语言中段错误原因?
2019-04-16
小白请教一个关于C语言字符串的问题?
2019-04-11
小白请教一个关于分类的问题
2019-02-09
C++小白,求教一个问题
2018-09-16
TA创建的收藏夹 TA关注的收藏夹
TA关注的人