码迷,mamicode.com
首页 >  
搜索关键字:r语言中的 vector    ( 11651个结果
list<> 中find的使用
昨天要在 std::list 中判断是否存在某一字符串 std::string 。我首先想先迭代+std::string自带的"==" 判断,也就是 list listStr; string s1; for(vector::iterator itr=lis...
分类:其他好文   时间:2014-06-15 23:55:32    阅读次数:386
topcoder SRM 624 DIV2 CostOfDancing
排个序,求前k个元素和即可 int minimum(int K, vector danceCost) { sort(danceCost.begin(),danceCost.end()); return accumulate(danceCost.begin()...
分类:其他好文   时间:2014-06-15 21:53:14    阅读次数:201
topcoder SRM 624 DIV2 BuildingHeightsEasy
从大到小遍历一遍,每次取M个元素,然后求得最小的floor即可 int minimum(int M, vector heights) { sort(heights.begin(),heights.end()); int minFloor = 10000; ...
分类:其他好文   时间:2014-06-15 21:48:45    阅读次数:229
随意输入N个英文字符,找出其中最长连续的排列。
intout_max_length_crease_str(constchar*p,std::vector&vct){ vct.clear(); intnlen=strlen(p); if(nlen==0){ return0; } if(nlen==1){ vct.push_back(p); r...
分类:其他好文   时间:2014-06-15 21:01:04    阅读次数:178
[Java] MAP、LIST、SET集合解析
在JAVA的util包中有两个所有集合的父接口Collection和Map,它们的父子关系: java.util +Collection 这个接口extends自 --java.lang.Iterable接口 +List 接口 -ArrayList 类 -LinkedList 类 -Vector 类...
分类:编程语言   时间:2014-06-15 20:23:51    阅读次数:280
Codeforces Round #249 (Div. 2) A. Black Square
水题#include #include #include using namespace std;int main(){ vector a(4); cin >> a[0] >> a[1]>>a[2]>>a[3]; string str; cin >> str; int res = 0; for(in...
分类:其他好文   时间:2014-06-14 23:00:14    阅读次数:249
Codeforces Round #247 (Div. 2) B - Shower Line
模拟即可#include #include #include using namespace std;int main(){ vector a(5); for(int i = 0; i > g[i][j]; } } int maxHappiness = 0; ...
分类:其他好文   时间:2014-06-14 22:57:10    阅读次数:207
剑指offer (20) 打印螺旋矩阵
题目描述:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字class Solution {public: vector spiralOrder(vector > &matrix) { vector result; int nRows = matrix.s...
分类:其他好文   时间:2014-06-14 21:27:53    阅读次数:156
Codeforces Round #245 (Div. 2) B - Balls Game
暴利搜索即可#include #include #include using namespace std;int main(){ int n,k,x; cin >> n >> k >> x; vector c(n); for(int i = 0 ; i > c[i]; ...
分类:其他好文   时间:2014-06-14 18:47:42    阅读次数:206
leetcode Combination Sum
void dfs(int k,int target,vector& candidates,vector& sol,vector >& res){ if(target==0){ vector temp(sol); res.push_back(temp); return; }else if(tar...
分类:其他好文   时间:2014-06-14 10:31:07    阅读次数:196
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!