自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

二斗墨汁

待己以诚 待人以信

  • 博客(15)
  • 资源 (3)
  • 收藏
  • 关注

原创 笔记:makefile

今天学了点unix的命令, 前天学了点gdb的调试, 昨天学了点makefile的知识, 贴个makefile的笔记:/* hello.h */#ifndef __HELLO_WORLD__#define __HELLO_WORLD__void hello();#endif/* hello.cpp */#include #include "hello.h"v

2012-02-21 17:06:05 655

原创 试题:打印n位水仙花数

水仙花数指的是一个n位数(n≥3), 它的每个位上的数字的n次幂之和等于它本身.(例如:1^3 + 5^3 + 3^3 = 153) , 理论上, 最大的水仙花数不超过34位题目还是从 luciferisnotsatan 博客上看到的, 他的实现见:n位水仙花数由于C++中整数的取值范围受限, 所以下面的代码最大只能计算到n = 19的情形下面是我的实现代码:#include

2012-02-17 13:30:45 1320

原创 试题:网易笔试的一道题目

写一个程序,打印出以下的序列。(a),(b),(c),(d),(e)........(z)(a,b),(a,c),(a,d),(a,e)......(a,z),(b,c),(b,d).....(b,z),(c,d).....(y,z)(a,b,c),(a,b,d)....(a,b,z),(a,c,d)....(x,y,z)....(a,b,c,d,.....x,y,z)这道

2012-02-16 15:21:42 910

原创 写在情人节的小程序

"对你爱 爱 爱不完"!#include using namespace std;int main(){ for (unsigned char times = 0; times <= 255; ++times) { cout << "我爱你!" << endl; } return 0;}"说一万遍我爱你

2012-02-14 14:03:00 1572

原创 试题:复数类

#include using namespace std;class Complex{public : Complex(double real = 0.0, double img = 0.0); Complex(const Complex & other); friend ostream & operator << (ostream & os, const Co

2012-02-14 12:35:41 574

原创 试题:实现堆

堆的实现:#include #include using namespace std;template void __push__heap(RandomAccessIterator start, RandomAccessIterator end, T *, CompareFunc comp){ if (end - start =

2012-02-13 18:15:26 455

原创 试题:如何利用一个6面概率均匀的骰子把一个苹果公平地交给七个孩子中的某一个(下)

在没看8楼前, 我也想了个方案:取七个骰子, 第一个骰子标号1-6, 第二个7-12, ..., 第六个标号31-36, 第七个标号37-42, 一起扔, 就会得到(1, 42)中的七个值, 这42个值对7取余后加1的结果有7种情况1-7, 且取[1, 7]都有5种情况, 也就是说, 这七个骰子一起扔后, 得到的点数对7取余加1后理论上应该均匀的得到[1, 7], 下面考虑这些经过计算处理的值

2012-02-12 18:59:59 1686

原创 试题:如何利用一个6面概率均匀的骰子把一个苹果公平地交给七个孩子中的某一个(上)

写作该文的目的是出于对帖子: 一个骰子有6面, 概率均匀, 我如何选择7件事? 有些疑问和想法帖子中对8楼的方案呼声最高:8楼的方案如下:用一个骰子扔一次得到x, 再仍一次得到y, 如果x, y都为6就不算, 重来该方案原理是利用表达式(6x-6+y)可以得到[1, 36], 再去除x, y都为6的情形, 得到[1, 35], 这35个数字对7取余后再加1, 就会得到5个1,

2012-02-12 18:38:52 1458

原创 试题:用123456789和+-*/组合出100

#include using namespace std;struct MyException{};double Plus(double first, double second){ return (first + second);}double Minus(double first, double second){ retu

2012-02-10 18:47:34 2207

原创 试题:集合的划分问题

输入集合{ 1, 2, 3 }输出结果:{ {1}, {2}, {3} }{ {1}, {2, 3} }{ {1, 3}, {2} }{ {1, 2, 3} }试编写相应算法:#include #include #include #include using namespace std;template void set(const vect

2012-02-08 18:48:44 854

原创 试题:组合的模板非递归实现

#include #include #include using namespace std;template void show(const vector & element, const vector & index){ assert(index.size() > 0); assert(element.size() >= index.size()

2012-02-08 12:33:40 564

原创 试题:实现strstr

#include #include using namespace std;char * strstr(char * str1, char * str2){ assert(NULL != str1 && NULL != str2); if ('\0' == *str2) { return str1; } whil

2012-02-07 13:25:33 643

原创 试题:跳马问题

#include #include using namespace std;const int row = 5;const int col = 5;bool move(int r, int c, int & index, int step[row][col]){ if (r >= 0 && c >= 0 && r < row && c < col && 0

2012-02-02 13:40:00 1352

原创 试题:求1000000以内的素数

之前无聊时, 写的找素数的代码, 记得当年考二级C时, 有这么一道上机题, 那时候求稳, 效率肯定不高, 所以今天用了排除法来做先给出总的测试代码:#include #include #include using namespace std;#define MAX_DATA 1000000int size;int data[MAX_DATA / 2 + 1]

2012-02-01 18:18:54 3107 2

原创 试题:将罗马数字转为阿拉伯数字

#include #include #include #include #include #include #include using namespace std;void Arabic2Roman(int arabic, list & roman){ ......}struct Exception{};int A

2012-02-01 18:01:30 893

yanrk-common

个人封装的跨windows、linux的公共组件库, GitHub URL: git@github.com:yanrk/common.git

2013-08-13

C_C++指针经验总结

指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址。 要搞清一个指针需要搞清指针的四方面的内容:......

2008-12-07

全国二级C++历年试题

二级C++历年试题,内含2005-09到2007-09的历年的全国二级考试试题

2008-12-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除