随笔分类 -  语言_STL

STL_map
摘要:map m;int main(){ m["123"] = 1123; cout<<m["123"]<<endl; return 0;} 阅读全文
posted @ 2013-07-10 21:32 wwjyt 阅读(119) 评论(0) 推荐(0)
STL_set
摘要:#include #include #include #include using namespace std;int main(){ int N, max, count; char ss[11]; string s; multiset S; scanf("%d", &N); while(N--) { gets(ss); s = ss; S.insert(s); count = S.count(s); if(count > max) max = count; ... 阅读全文
posted @ 2013-07-10 21:23 wwjyt 阅读(140) 评论(0) 推荐(0)
STL_Algorithm
摘要:#include #include using namespace std;/*虽然最后一个排列没有下一个排列,用next_permutation会返回false,但是使用了这个方法后,序列会变成字典序列的第一个,如cba变成abc。prev_permutation同理。*/int main(){ char a[6] = "ABCDE"; do { printf("%.3s\n",a); }while(next_permutation(a,a+5)); return 0;} 阅读全文
posted @ 2013-07-10 20:56 wwjyt 阅读(138) 评论(0) 推荐(0)
STL_string
摘要:#include #include using namespace std;/* scanf 不支持 string *//* 字符用单引号 串用双引号 *//* s.insert() 只能插入一个字符 *//* s.append() 还有 + 号 追加字符或者字符串都可以 *//* s.begin() s.end 可以代替迭代器 *//* 迭代器 it 需要初始化! ... 阅读全文
posted @ 2013-07-10 20:49 wwjyt 阅读(241) 评论(0) 推荐(0)
vector 有点麻烦啊 能简单点么?
摘要:#include #include #include #include #include using namespace std;vector v;vector::iterator it;vector::iterator te;int main(){ int N; freopen("1.txt", "r", stdin); while(scanf("%d", &N) == 1) { v.clear(); for(int i = 0 ; i < N ; i++) { int temp; ... 阅读全文
posted @ 2013-07-03 00:32 wwjyt 阅读(193) 评论(0) 推荐(0)
不能用printf 直接打印 string类,可以 Str.c_str()
摘要:rt 阅读全文
posted @ 2013-07-02 23:16 wwjyt 阅读(220) 评论(0) 推荐(0)
pair queue____多源图广搜
摘要:1、简介 class pair ,中文译为对组,可以将两个值视为一个单元。对于map和multimap,就是用pairs来管理value/key的成对元素。任何函数需要回传两个值,也需要pair。 该函数的相关内容如下所示: |->Type----->struct |->Include---> |->Define----> pair(first,second) | |->member | |------>first | |------>second... 阅读全文
posted @ 2013-06-24 15:27 wwjyt 阅读(387) 评论(0) 推荐(0)