文章列表
 
您正在查看 "c++ stl" 分类下的文章

2010-05-28 0:26


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int Visit(int v) // 遍历算子函数
{
    cout << v << " ";
    return 1;
}

class MultInt // 定义遍历算子类
{
      private:
               int factor;
  

 
2010-05-27 23:53

#include <iostream>
#include <queue>
using namespace std;
class T
{
   public:
   int x, y, z;
   T(int a, int b, int c):x(a), y(b), z(c) { }
};
bool operator < (const T &t1, const T &t2)
{
     return t1.z < t2.z; // 按照z的顺序来决定t1和t2的顺序
}
int main()
{
priority_queue<T> q;
q.push(T(4,4,3));
q.push(T(2,2,5));
q.push(T(

 
2010-01-29 10:02
http://acm.swjtu.edu.cn/JudgeOnline/showproblem?problem_id=1602

题大意:输出n个数字,输出前十个最大的值。注意:数值有10^25大,只能用字符串存储,而且每个数都可能会出来前缀为0的情况,刚学STL不久。借用这题来试试效果。STL用起来还不是很熟悉。调试了很久啊。

code1:

#include <iostream>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
c

 
2009-07-31 22:54
前言: STL,为什么你必须掌握
对于程序员来说,数据结构是必修的一门课。从查找到排序,从链表到二叉树,几乎所有的算法和原理都需要理解,理解不了也要死记硬背下来。幸运的是这些理论都已经比较成熟,算法也基本固定下来,不需要你再去花费心思去考虑其算法原理,也不用再去验证其准确性。不过,等你开始应用计算机语言来工作的时候,你会发现,面对不同的需求你需要一次又一次去用代码重复实现这些已经成熟的算法,而且会一次又一次陷入一些由于自己疏忽而产生的bug中。这时,你想找一种工具,已经帮你实
 
 
   
 
 
文章存档
 
     
 
最新文章评论
  

条理很清晰
 

什么是多重队列?跪求!!!
 

orz ...
 

请问这个代码,错在什么地方了?一直是 running time error 我是不是少考虑了什么条
 

#include<iostream> #include<algorithm> #include<string.h> using namespace std;
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu