- 博客(19)
- 资源 (61)
- 收藏
- 关注
原创 你真的会二分查找吗?
最简单的二分查找算法:即找到返回下标,找不到返回-1,(坐标范围:0~nums.size() - 1)#include #include #include #include #include #include #include #include using namespace std;int BinarySearch(vector& nums, int target)
2016-10-30 23:11:29 561
原创 34. Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found
2016-10-30 22:48:37 494 1
原创 MD5算法实现
md5.h#ifndef MD5_H#define MD5_Htypedef struct{ unsigned int count[2];/* 位数量, 模 2^64 (低位在前) */ unsigned int state[4];/* state (ABCD) */ unsigned char buffer[64];/* 输入缓冲器 */}MD5_CTX;//非线性辅助函
2016-10-30 21:48:57 572
原创 70. Climbing Stairs QuestionEditorial Solution
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?DFS#include #incl
2016-10-27 23:04:38 396
原创 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two number
2016-10-26 23:41:48 519
原创 303. Range Sum Query - Immutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2, 5) -> -1sumRan
2016-10-25 18:29:33 398
原创 136. Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e
2016-10-25 14:40:22 385
原创 leetcode水题题解
344. Reverse StringWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".class Solution {public: string reverseString(stri
2016-10-25 09:52:04 535
原创 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5
2016-10-25 09:47:19 478
原创 419. Battleships in a Board
Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receiv
2016-10-24 23:40:48 1168
原创 GDI+如何判断一个点是否在区域内
https://msdn.microsoft.com/en-us/library/windows/desktop/ms533826(v=vs.85).aspxThe purpose of hit testing is to determine whether the cursor is over a given object, such as an icon or a butt
2016-10-24 12:20:10 2387
原创 WTL使用双缓冲避免重绘闪烁
1、继承自CDoubleBufferImpltemplate class CDoubleBufferImpl{public:// Overrideables void DoPaint(CDCHandle /*dc*/) { // must be implemented in a derived class ATLASSERT(FALSE); }// Message m
2016-10-17 19:55:45 931
原创 gdi+学习笔记
RECT rect; //获得客户区坐标 GetClientRect(&rect); //Graphics作图对象 Graphics g(m_hWnd);画线:Pen pen(Color(255, 0, 0, 0)); g.DrawLine(&pen, rect.left, rect.top, rect.right, rect.bottom); g.DrawLi
2016-10-17 16:04:19 457
原创 可移动窗口
基于VS2013+WTL9.1实现// MoveableWindowView.h : interface of the CMoveableWindowView class///////////////////////////////////////////////////////////////////////////////#pragma once#include "MyWindo
2016-10-16 20:06:04 664
转载 C++零食:WTL中使用双缓冲避免闪烁
在自己画的窗口中,有时候会有闪烁现象。为什么会有闪烁现象呢?其实是因为程序在画窗口时需要用背景色清空显示区域,然后再画。由于这两者的反差比较大,就会被人眼睛捕捉到,感觉闪烁。双缓冲就是先在内存中把图画好,然后直接复制到屏幕上去,这样的反差就比较小,也就不觉得闪烁了。 WTL中的CDoubleBufferImplWTL中有现成的双缓冲类实现
2016-10-15 19:55:00 1173
原创 Drcom校园网自动登录
主要是懒得每次上网都需要打开网页=。=logon.bat@echo offmode con: cols=40 lines=15color 0atitle 登录ing...rem 获得IPwget "https://lgn6.bjut.edu.cn/V6?https://lgn.bjut.edu.cn" --post-data="DDDDD=学号&upass=密码&v46s=0&
2016-10-07 23:46:26 20431
原创 链式队列
RationQueue.h#pragma onceclass RationQueue{public: RationQueue(); ~RationQueue();public: bool push(double d); //入栈 bool pop(double &data); //出栈 bool empty(); //判断栈是否为空private: typed
2016-10-06 23:06:40 351
原创 内存对齐规则
结构体(struct)/联合体(union)里的数据成员:第一个数据成员放在offset为0的地方,以后每个数据成员存储的起始位置要从该成员大小的整数倍开始。结构体作为成员:如果一个结构里有某些结构体成员,则结构体成员要从其内部最大元素大小的整数倍地址开始存储。结构体的总大小对齐:也就是sizeof的结果,必须是其内部最大成员的整数倍,不足的要补齐。VS2013 + W
2016-10-01 20:36:56 481
原创 ATL窗口
标准的Windows应用程序框架:/*------------------------------------------------------------ HELLOWIN.C -- Displays "Hello, Windows 98!" in client area (c) Charles Petzold, 1998 -----------
2016-10-01 13:47:15 441
lua-cjson-2.1.0-已编译
2018-04-16
mybatis plugin 3.21破解补丁
2017-11-13
QQWry-源码
2017-11-13
Privacy in Location-Based Applications
2017-10-17
BJUT数字图像处理作业
2017-01-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人