c++
文章平均质量分 68
sen_lin8350
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
struct hdr_ip
/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/common/ip.h对一些重要的地方加一些中文注解00037 /* a network layer; basically like IPv6 */00038 #ifndef ns_ip_h00039 #define ns_ip_h00040 00041 #include "config.h"00042转载 2014-03-28 22:33:52 · 914 阅读 · 0 评论 -
大数减法
/*输入两行字符串正整数,第一行是被减数,第二行是减数,输出第一行减去第二行的结果。 备注:1、两个整数都是正整数,被减数大于减数示例: 输入:1000000000000001 1 输出:1000000000000000 注意大数用char a[] 存储,用%s接收,一位一位的运算。注意a[0]里的正负号 */#include #incl原创 2014-07-11 19:33:17 · 450 阅读 · 0 评论 -
01背包问题
#include #include using namespace std;class OneZeroPacket{ public: OneZeroPacket(int wei, int nu, int *vl, int *wl):weight(wei),number(nu) { v原创 2014-06-19 22:23:01 · 424 阅读 · 0 评论 -
编程之美,3.11程序改错, 二分扩展
#include using namespace std;int find1(int *a, int start, int end, int b){//给定一个有序序列a,求任意一个i使得a[i]等于b,不存在返回-1. int mid; while(start<=end){ mid = start + (end-start)/2; if(a[mid]<b){ star原创 2014-07-22 20:09:46 · 504 阅读 · 0 评论 -
线索二叉树
二叉树的定义#ifndef TREE#define TREE#include using namespace std;struct TreeNode { char val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};st原创 2014-06-28 20:30:23 · 394 阅读 · 0 评论 -
编程之美--精确表达浮点数
2. 一问题描述: 使用分数形式来表示小数,有限小数和无限循环小数都可以转化为分数。 例如: 0.9 = 9 / 10 。 0.33333(3) = 1 / 3 。 二问题分析: (1) 若是有限小数,则可以使用以下方法: 0.a1 a2 a3 a4 a5 ..an = a1 a2 a3 a4 a5 a6 an / 10原创 2014-06-25 22:46:56 · 456 阅读 · 0 评论 -
2014年腾讯实习生招聘最后一题
题目来源于:http://blog.chinaunix.net/uid-29038263-id-4198455.html给定n块木板A[1...n],高度记为A[i],每块目标高度不等,宽度相等,用这些木板排列成一面木板墙,木板排列好后,求解木板墙中最大的矩形面积,请设计算法求得木板墙最大的矩形面积,并分析算法效率。举例说明,如下图所示的木板排列,最大矩形面积为深灰色区域,即4*3原创 2014-04-25 11:16:36 · 719 阅读 · 1 评论 -
Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".原创 2014-05-05 09:39:33 · 485 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
class Solution {public: bool valid_operator(const string token){ return(token.compare("+") == 0 || token.compare("-") == 0 || token.compare("*") == 0 || tok原创 2014-05-05 09:36:19 · 501 阅读 · 0 评论 -
MOVE.jar+sumo悲剧的一天
用MOVE时,create Loading configuration... Warning: Please note that 'xml-node-files' is deprecated.Use 'node-files' instead.Warning: Please note that 'xml-edge-files' is deprecated.Use 'edg原创 2014-04-17 22:50:47 · 1554 阅读 · 1 评论 -
ns2中静态成员变量的绑定
class Packet{.....static int hdrlen;}需要将hd翻译 2014-04-16 19:18:06 · 618 阅读 · 0 评论 -
ns2中变量的绑定
ASRMAgnet::ASRMAgent(){ bind("pdistance")翻译 2014-04-16 18:42:30 · 704 阅读 · 0 评论 -
struct hdr_cmn
//对ns2中的hdr_cmn头 ,源码进行注解//源码来源于http://www.cs.mun.ca/~yzchen/code/ns-2.33/packet_8h_source.html struct hdr_cmn { enum dir_t { DOWN= -1, NONE= 0, UP= 1 packet_t ptype_; // pack转载 2014-03-28 22:42:00 · 881 阅读 · 0 评论 -
二叉树非递归遍历
中序遍历vector midorderTraversal(TreeNode *root){ vector temp; stack s; bool left = false; bool right = false; if(root == NULL) return temp; TreeNode* p = root;原创 2014-06-22 12:18:04 · 449 阅读 · 0 评论
分享