码迷,mamicode.com
首页 >  
搜索关键字:r语言中的 vector    ( 11651个结果
1015 德才论
没啥好说的,按题意排序输出即可。 STL:vector,string.用cin/cout可能会超时,改成scanf和prinf即可。 #include"iostream" #include"algorithm" #include"vector" using namespace std; struct ...
分类:其他好文   时间:2020-02-15 21:51:58    阅读次数:72
POJ3177 Redundant Paths
双连通图:无向图中每两个顶点都存在完全不同的两条路径 给定一个无向图,问要给它增加多少条边可以把它变成双连通图。 用tarjan缩点,可以得到一棵树,添加(叶子结点+1)/2条边可以使其成环,也就是答案~ 为了避开重边,这题用邻接矩阵存,wa了一晚上QAQ~ #include<cstdio> #in ...
分类:其他好文   时间:2020-02-15 20:37:22    阅读次数:66
46.二叉搜索树的后序遍历序列
解题思路:利用二叉搜索树性质 可以确定10为根节点, class Solution { public: vector<int> seq; bool verifySequenceOfBST(vector<int> sequence) { seq = sequence; return dfs(0, se ...
分类:其他好文   时间:2020-02-15 18:27:30    阅读次数:67
luoguP5445 [APIO2019]路灯 树套树+set
code: #include <vector> #include <cstdio> #include <cstring> #include <map> #include <set> #include <algorithm> #define N 300005 #define MAX 320005 #d ...
分类:Windows程序   时间:2020-02-15 18:26:47    阅读次数:97
739. 每日温度
根据每日 气温 列表,请重新生成一个列表,对应位置的输入是你需要再等待多久温度才会升高超过该日的天数。如果之后都不会升高,请在该位置用 0 来代替。 例如,给定一个列表 temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是 [1, 1, 4, ...
分类:其他好文   时间:2020-02-15 13:12:03    阅读次数:47
Codeforces Round #592 (Div. 2) E
给你一个数组,你最多可以进行k次操作,每次操作可以使一个数+1或者-1,问操作之后数组的极差最小可能是多少 利用map来模拟移动,可以观察到每次应该选择数量少的一组数让他们进行移动是最优的 int main(){ int n; ll k; cin >> n >> k; vector<int> a(n ...
分类:其他好文   时间:2020-02-15 09:17:24    阅读次数:52
SPOJ QTREE Query on a Tree【树链剖分模板题】
树链剖分,线段树维护~ #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAXN = 1001 ...
分类:其他好文   时间:2020-02-14 23:05:58    阅读次数:151
1005 继续(3n+1)猜想
#include"iostream" #include"vector" #include"algorithm" using namespace std; bool hashtable[20000] = {false}; //因为待映射的值可能比较大,所以数组开大一点,不然最后两个测试点会出现 段错误 ...
分类:其他好文   时间:2020-02-14 23:05:21    阅读次数:132
有序全排列c++实现(递归)
1 #include <iostream> 2 #include <algorithm> 3 #include <iterator> 4 #include <vector> 5 using namespace std; 6 int number; 7 vector<int> vec; 8 vecto ...
分类:编程语言   时间:2020-02-14 20:44:14    阅读次数:64
模板与泛型编程
C++ templates的最初发展动机很直接:让我们得以建立“类型安全”的容器如vector,list和map。然而当愈多人用上templates,他们发现templates有能力完成愈多可能的变化。容器当然很好,但泛型编程——写出的代码和其所处理的对象类型彼此独立——更好。STL算法如for_e ...
分类:其他好文   时间:2020-02-14 20:31:52    阅读次数:85
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!