- 博客(14)
- 收藏
- 关注
原创 2015编程之美测试赛第二题之大神与三位小伙伴
#include #include using namespace std;int main(){ int n; cin >> n; int *data = new int[n]; long long value = (pow(10, 9) + 7); long long *count = new long long[n](); int i = 0; while (i <
2015-04-12 18:07:49
520
原创 2015腾讯实习生笔试回忆录
(在此备忘,有好的解法可以分享,共同学习探讨!) 一、不定项选择1、围棋棋盘,横纵线分别19条,横纵线等距排列,求棋盘上一共有多少个正方形;2、vector与list相比,其优势是什么?3、有100个人,91个作对第一题,81个作对第二题、85个作对第三题、74个作对第四题、79个作对第五题。只有当作对三道或三道以上才算及格,问至少有多少个及格。66 55 74
2015-04-01 21:12:35
747
原创 2015华为实习生招聘机试模拟考1之求一个int型证书的两种递减数之和
#include #include #include using namespace std;int DJS_sum(int goal){ vector djs;//存储所有递减数; vector bitval; int maxSum = 0;//递减数中各位数之和最大的和 int maxval = 0;//递减数中各位数之和最大的递减数 while (goal) {
2015-03-26 10:14:05
1085
原创 2015华为实习生招聘机试模拟考1之密码截取
#include using namespace std;int research2(char *str){ int len = strlen(str); if (str == NULL || len < 1) { return 0; } if (len < 2) { return 1; } char *begin; char *end; int count =
2015-03-26 10:12:39
1131
原创 华为2015年春季机试(初级)根据给出日期得出下一天
#include #include using namespace std;vector OutputData(unsigned int year,unsigned int month, unsigned int data){ vector result; bool run = false; if ((year % 4 == 0 && year % 100 != 0) || year
2015-03-23 20:52:28
740
原创 关于Mat的拷贝、赋值
关于Mat的浅复制(占用相同内存,处理其中一个,会影响另外一个)& 深复制(生成副本,占用不同内存,相互之间无影响) Mat A, C; // creates just the header parts
2015-01-25 20:19:52
903
原创 QT中鼠标位置获取问题之event->globalPos()与pos()函数
最近在学习QT,准备做个界面程序,在获取鼠标位置信息时,查了好多资料,对于event->globalPos()与pos()函数都说的不是很清楚。通过程序测试,最后是搞清楚了,在这利用形象的图解来代替文字像大家描述。widget窗口是带边框的类型,如下图(上边框和侧边框都是有厚度的)1.而由event->globalPos()获取的鼠标位置是鼠标偏离电脑屏幕左上角(x=0,y=0
2015-01-03 19:41:29
22635
1
原创 类和结构
类描述看上去很像是包含成员函数以及public和private可见性标签的结构声明。实际上,C++对结构进行了扩展,使之具有与类相同的特性。他们之间唯一区别是:结构默认访问类型是public,而类为private。C++程序员通常使用类来实现类描述,而把结构限制为只表示纯粹的数据对象或没有私有部分的类。
2014-12-22 09:45:26
458
转载 leetcode之Trapping Rain Water
这是我转载的一篇博文,我觉得这道题分析的很清晰,易懂,特此收藏!Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For exam
2014-12-20 11:11:58
557
原创 C++中容器vector的使用方法
C++中的vector 使用范例一、概述vector 是C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。vector 是一个容器,它能够存放各种类型的对象,简单地说,vector 是一个能够存放任意类型的动态数组,可以动态改变大小。例如:// c 语言风格int myHouse[100] ;// 采用vectorvec
2014-12-04 10:08:45
965
原创 Binary Tree Postorder Traversal 二叉树的后序遍历,使用堆栈,非递归
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla
2014-12-04 10:01:47
767
原创 Binary Tree Inorder Traversal 二叉树中序遍历,使用堆栈,非递归
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla
2014-12-04 09:54:48
690
原创 Binary Tree Preorder Traversal 二叉树的先序遍历,使用堆栈,非递归
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla
2014-12-04 09:47:52
679
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人