原创 T-SQL(一)遊標嵌套查詢

數據源 pubs 示例數據庫 目標 利用遊標用於生成作者出版情況報表,形式如下: -------- Authors report -------- ----- Books by Author: AuthorName1

原创 OpenGL(一)GLFW的使用

#include "stdafx.h" #include<GL/freeglut.h> #include<GLFW/glfw3.h> int main() { // 初始化 glfwInit(); // 創建新的環境

原创 優化算法(四)蟻羣算法

import numpy as np import matplotlib.pyplot as plt # 計算距離和 def distance_sum(point, distances): res = 0. f

原创 優化算法(五)元胞自動機

import numpy as np import matplotlib.pyplot as plt # 空間大小 number = 200 # 細胞分佈 cells = np.zeros((number, number))

原创 優化算法(二)模擬退火算法

import numpy as np # 隨機確定變化的方向 def direction2(): if np.random.random() > 0.5: return 1 return -1

原创 優化算法(三)遺傳算法

import numpy as np # 二進制基因編碼轉十進制 def conv_2_10(x): val = 0 for v in range(len(x)): if x[-1*(v+1)]

原创 優化算法(一)粒子羣算法

import numpy as np def pso(fitness, D=1, c1=2, c2=2, w=0.8, N=200, M=1000): # 函數返回待優化函數的最小值和對應的解 # fitn

原创 T-SQL(三)創建觸發器

數據源 pubs 示例數據庫 目標 創建 authors 表的日誌表,記錄修改city 列時的用戶、新值、舊值、時間 代碼 -- 創建修改日誌 create table authors_log( username varchar(

原创 LeetCode-12 整數轉羅馬數字

C++ class Solution { private: const char* l1[10] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};

原创 LeetCode-14 最長公共前綴

C++ class Solution { public: string longestCommonPrefix(vector<string>& strs) { if(strs.size()==0){return

原创 LeetCode-13 羅馬數字轉整數

C++ class Solution { public: int romanToInt(string s) { int length = s.length(); int res = 0;

原创 LeetCode-11 盛最多水的容器

C++ class Solution { public: int maxArea(vector<int>& height) { int begin = 0; int end = height.s

原创 OpenGL(四)矩陣變換

 OpenGL使用齊次座標矩陣棧進行矩陣變換,每一次矩陣操作,變換矩陣都會與矩陣棧的當前棧頂矩陣點乘,座標變換順序是變換矩陣點乘順序的逆序 矩陣也可以使用OpenGL矩陣類,類中包含了大量常用的矩陣操作

原创 Bootstrap(三)可視化佈局系統

Bootstrap可視化佈局系統 拖動組件 選擇編輯  編輯內容 下載代碼  

原创 LeetCode-10 正則表達式匹配

C++ class Solution { public: bool isMatch(string s, string p) { int sl = s.length(); int pl = p.l