摘要:极光炫影 发表于 2006-04-12 20:09:52 /* 解决ZOJ1128的线段树模板1757411 2006-04-12 19:51:35 Accepted 1128 C++ 00:00.00 484K 极光炫影 Author : JGShining Date : 2006-04-12*/#include<cstdio>#include<cassert>#include<algorithm>using namespace std;typedef struct ITREE_NODE{ ITREE_NODE *pLChild, *pRChild; do 阅读全文
Floyd-Warshall多源最短路径
2008-02-18 01:53 by OntheMars, 146 阅读, 0 推荐, 收藏,
摘要:Floyd-Warshall多源最短路径 const int MAXN = 101 ; const int INF = 1000000 ; int g[MAXN][MAXN]; int d[MAXN][MAXN]; int floyd( int n) { int i,j,k; for (i = 1 ;i <= n;i ++ ) for (j = 1 ;j <= n;j ++ )d[i][j] = g[i][j]; for (k = 1 ;k <= n;k ++ ) { for (i = 1 ;i <= n;i ++ ) for (j = 1 ;j <= n;j + 阅读全文
STL小结(原创)
2008-02-18 01:51 by OntheMars, 203 阅读, 0 推荐, 收藏,
摘要:转自http://www.cnitblog.com:80/cockerel/STL小结(原创) STL 概述: 使用容器前增加 #pragma warning(disable: 4786) 指令 字符串容器只储存指针,请另外用数组存放真正的串(当然你也可以使用STLstring) 断言 在模板参数,传递类名,在 ( 离散 ) 函数参数中,使用函数名 ( myStruct(); 或 myFunc ) 内置 <functional> : greater <T>, less<T>, greater_equal<T>, less_equal<T&g 阅读全文
单源最短路 Dijkstra O(mlogn) (类实现)
2008-02-18 01:46 by OntheMars, 223 阅读, 0 推荐, 收藏,
摘要:转载自 Felicia 的bolg单源最短路 Dijkstra O(mlogn) (类实现) 单源最短路 Dijkstra O(mlogn) (类实现)#include<iostream>#include<vector>#include<map>#definemaxn1010usingnamespacestd;typedefdoubleweight;classgraph_c{public:voidinit(int_n);voiddijkstra(intS);voidadd_edge(intu,intv,weightw);private:intn;vector 阅读全文
凸包(类实现)
2008-02-18 01:44 by OntheMars, 166 阅读, 0 推荐, 收藏,
摘要:凸包(类实现) /**//*************************************************************************Author:WHU_GCCCreatedTime:2007-8-1313:59:37FileName:convex_hull.cppDescription:************************************************************************/#include<iostream>usingnamespacestd;#defineout(x)(cout&l 阅读全文
An easy DP problem HDOJ 1176
2008-02-18 01:43 by OntheMars, 128 阅读, 0 推荐, 收藏,
摘要:An easy DP problem - HDOJ 1176极光炫影 发表于 2005-12-22 15:03:44 #include<stdio.h>#include<algorithm>using namespace std;struct DATA{ int x, t;};DATA data[100000];int stateold[11], statenew[11], cost[11];bool cmp(const DATA&a, const DATA&b){ if(a.t != b.t) return a.t < b.t; else ret 阅读全文
哈夫曼树
2008-02-18 01:42 by OntheMars, 148 阅读, 0 推荐, 收藏,
摘要:转自 极光炫影 的blog/*http://coder.buct.edu.cn:8080/JudgeOnline/showproblem?problem_id=1078*/好久没有做题目了, 找了一个哈夫曼树的题目。#include <iostream>#include <functional>#include <algorithm>#include <vector>using namespace std;int main(){ int n, e; vector<int> s; int i; int total; while(cin 阅读全文
数的划分
2008-02-18 01:40 by OntheMars, 165 阅读, 0 推荐, 收藏,
摘要:转自 农夫三拳 的blog数的划分 /**//*http://acm.hnu.cn:8080/online/?action=problem&type=show&id=10390*/#include <iostream>#include <vector>using namespace std;long long r[221][11][221];int f(int m, int n, int c){ //只要分成两列,在首位数字确定的情况下只可能有一种分法 if( n <= 2 ) return 1; int i; int result = 0; in 阅读全文
C/C++ 程序设计员应聘常见面试试题深入剖析
2008-01-30 14:08 by OntheMars, 175 阅读, 0 推荐, 收藏,
摘要:原文地址http://blog.csdn.net/sdspp/archive/2006/09/20/1255179.aspxC/C++ 程序设计员应聘常见面试试题深入剖析 1.引言 本文的写作目的并不在于提供C/C++程序员求职面试指导,而旨在从技术上分析面试题的内涵。文中的大多数面试题来自各大论坛,部分试题解答也参考了网友的意见。 许多面试题看似简单,却需要深厚的基本功才能给出完美的解答。企业要求面试者写一个最简单的strcpy函数都可看出面试者在技术上究竟达到了怎样的程度,我们能真正写好一个strcpy函数吗?我们都觉得自己能,可是我们写出的strcpy很可能只能拿到10分中的2分。... 阅读全文
使用scintilla编译c++方法
2007-10-05 15:47 by OntheMars, 747 阅读, 0 推荐, 收藏,
摘要:最近发现一个开源文本编辑器scintilla,速度快,提供语法高亮等功能,可以用来编程.不过编译程序要自己配置,这个比较麻烦.在网上寻得此文,讲的不错. 十分感谢原作者.[分享]scintilla + bcc55打造简洁的c++开发环境 转自www.LiDuan.com你也可以用DEV-C++, 但是gc++在windows环境下表现得并不好。比如, 写个很简单的代码,只包括一条cout,用dev-cpp编译出来有500k, 用bc5.5编译只有111k, 我写的unix时间戳转换用dev-cpp编译900k,bcc5.5编译200k(g++在linux下编译14k).因此,我建议初学者在w. 阅读全文
浙公网安备 33010602011771号