05 2017 档案

阿拉伯数换成英文
摘要:#include #include #include #include #include #include #include using namespace std; string num1[]={"","thousand","million","billion"}; string num2[] = { "","","twenty","thirty","forty","fif... 阅读全文

posted @ 2017-05-31 21:02 zhaodun 阅读(168) 评论(0) 推荐(0)

称重量
摘要:题目描述 现有一组砝码,重量互不相等,分别为m1,m2,m3…mn;每种砝码对应的数量为x1,x2,x3...xn。现在要用这些砝码去称物体的重量,问能称出多少中不同的重量。 现有一组砝码,重量互不相等,分别为m1,m2,m3…mn;每种砝码对应的数量为x1,x2,x3...xn。现在要用这些砝码去 阅读全文

posted @ 2017-05-31 20:00 zhaodun 阅读(305) 评论(0) 推荐(0)

计算机网络
摘要:整理一下计算机网络部分的面试常考点,参考书籍:《计算机网络》第五版 谢希仁的那本,希望对大家有所帮助 OSI,TCP/IP,五层协议的体系结构,以及各层协议 OSI分层 (7层):物理层、数据链路层、网络层、传输层、会话层、表示层、应用层。 整理一下计算机网络部分的面试常考点,参考书籍:《计算机网络 阅读全文

posted @ 2017-05-31 15:57 zhaodun 阅读(330) 评论(1) 推荐(0)

进程间的通信方式与区别
摘要:进程间通信就是在不同进程之间传播或交换信息,那么不同进程之间存在着什么双方都可以访问的介质呢?进程的用户空间是互相独立的,一般而言是不能互相访问的,唯一的例外是共享内存区。但是,系统空间却是“公共场所”,所以内核显然可以提供这样的条件。除此以外,那就是双方都可以访问的外设了。在这个意义上,两个进程当 阅读全文

posted @ 2017-05-30 22:55 zhaodun 阅读(1983) 评论(0) 推荐(0)

求两IP是否在同一局域网(运子网掩码用)
摘要:反思:运用stringstream将string依次转换为int,用&求与操作 阅读全文

posted @ 2017-05-26 19:56 zhaodun 阅读(478) 评论(0) 推荐(0)

STL优缺点
摘要:C++ STL 的实现:1.vector 底层数据结构为数组 ,支持快速随机访问2.list 底层数据结构为双向链表,支持快速增删3.deque 底层数据结构为一个中央控制器和多个缓冲区,详细见STL源码剖析P146,支持首尾(中间不能)快速增删,也支持随机访问4.stack 底层一般用23实现,封 阅读全文

posted @ 2017-05-23 21:36 zhaodun 阅读(856) 评论(0) 推荐(0)

输出最大回文数
摘要:#include #include #include #include using namespace std; int main() { string str; //int i=0,j=0; while (getline(cin,str)) { int R=1; for (int i=1;i=0&&((i+j)R) R=j*2+1; } //判断abba... 阅读全文

posted @ 2017-05-23 10:38 zhaodun 阅读(847) 评论(0) 推荐(0)

将一组单词逆序输出
摘要:#include <iostream>#include <string>#include <vector>#include <stdlib.h>using namespace std;int main(){ string str; while(getline(cin,str)) { vector<s 阅读全文

posted @ 2017-05-22 22:51 zhaodun 阅读(429) 评论(0) 推荐(0)

排序算法
摘要:#include #include #include #include #include using namespace std; #define MAXSIZE 20 #define LT(a,b) ((a)0;--j) { if (array[j]i;--j) { if(array[j]array... 阅读全文

posted @ 2017-05-21 21:18 zhaodun 阅读(270) 评论(0) 推荐(0)

背包问题
摘要:背包问题是典型的DP问题,几乎所有类型的背包问题都可转化为DP运算。P01: 01背包问题题目有N件物品和一个容量为V的背包,第i件物品的费用是c[i],价值是w[i],每件物品仅有一件,求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。基本思路:f[i][v]表示前i件物 阅读全文

posted @ 2017-05-05 19:23 zhaodun 阅读(198) 评论(0) 推荐(0)

二进制
摘要:n&=(n-1); 能判断十进制数转二进制中1的个数 删除一个bit,每次a&(a-1)的结果会比a的二进制少一个bit,用个循环操作就可以算出有a多少个bit了 阅读全文

posted @ 2017-05-04 22:57 zhaodun 阅读(166) 评论(0) 推荐(0)

sstream
摘要:重复利用stringstream对象 如果你打算在多次转换中使用同一个stringstream对象,记住再每次转换前要使用clear()方法; 在多次转换中重复使用同一个stringstream(而不是每次都创建一个新的对象)对象最大的好处在于效率。stringstream对象的构造和析构函数通常是 阅读全文

posted @ 2017-05-03 19:58 zhaodun 阅读(245) 评论(0) 推荐(0)

整数逆序排序 去重
摘要:#include <iostream> #include <string> #include <stdlib.h> using namespace std; int main() { int num = 0,n=0; int a[10] = {0}; cin >> n; while(n) { if 阅读全文

posted @ 2017-05-03 09:13 zhaodun 阅读(262) 评论(0) 推荐(0)

导航