原创 89. Gray Code [leetcode]
89. Gray Code The gray code is a binary numeral system where two successive values differ in only one bit. Given a no
原创 彙編實驗 固定時間改變背景色及字符位置
題目:在屏幕上顯示一個“*”字符。要求背景顏色不斷改變(間隔0.5 秒),且“*”字符可在屏幕上無規則移動(速度0.1 秒)。 用中斷來控制時間間隔。寫的心好累。。。。然而這個隨機數的生成好像根據個人電腦的情況不同,我的電腦好像挺
原创 photo mosaic 拼圖馬賽克
photo mosaic 好多張圖片拼成一張完整的圖片 原理: 讀取原始圖片,進行分割,分析每個小塊RGB均值,並存儲。 讀取若干圖片,提取並存儲各個圖片的RGB均值。與原始圖片的每個小塊進行匹配。 可以採用OpenMP進行
原创 楊氏三角 彙編 16位
題目: 輸出楊氏三角 INCLUDE MACRO.LIB OUTARRY MACRO ARRY ;輸出數組 PUSH DI PUSH CX PUSH AX PU
原创 Opengl 單雙緩衝區區別
轉自http://blog.csdn.net/mfcappwizard/article/details/6965617 單緩衝,實際上就是將所有的繪圖指令在窗口上執行,就是直接在窗口上繪圖,這樣的繪圖效率是比較慢的,如果使用單緩衝,而電
原创 斐波那契數 32位windows 彙編
輸入N,輸出第N個斐波那契數 .386 .model flat,stdcall option casemap:none includelib msvcrt.lib printf PROTO C :dword,:VARARG scanf
原创 110. Balanced Binary Tree [leetcode]
用遞歸來解題。 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * T
原创 420. Strong Password Checker [leetcode]
思路: 有三個問題需要解決: 1、缺失字符種類問題(大寫,小寫、數字) 可用操作:replace,insert 2、長度問題 可用該操作:insert(< 6),delete(> 20) 3、重複問題 可用操作: replac
原创 164. Maximum Gap [leetcode]
這道題可以有兩種剛解法: 解法一: 基於bucket sort的方法: 有n個未排序的數字。 1、先求出數組內最大數max和最小數min。 2、求出每個桶內的數字範圍:gap = (max - min) / (n - 1)。 3、算出桶
原创 187. Repeated DNA Sequences [leetcode]
題目: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When stu
原创 220. Contains Duplicate III [leetcode]
題目: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the abs
原创 218. The Skyline Problem [leetcode]
題目: A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from
原创 150. Evaluate Reverse Polish Notation [Leetcode]
用stack來保存還未操作的數字。 一旦遇見操作符,則pop出stack中的頭兩個數字,進行計算,再把結果push進stack中。 class Solution { public: int evalRPN(vector<stri
原创 260. Single Number III [leetcode]
每次遇得這種位操作的新題,都不會做。 很無奈。看了大神的講解才恍然大悟。 哎。 原理就是對數組進行分組,使得兩個單獨的數a、b被分到不同的組。再在不同的組裏面通過異或的操作分別得出兩個數。 怎麼樣分組呢? 尋找a與b的不同點。此時,不用考
原创 384. Shuffle an Array [Leetcode]
利用swap+隨機數生成一個隨機的序列。 class Solution { public: Solution(vector<int> nums) { srand(time(NULL)); this-