This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int mask[9][9]; | |
void mask_gen_mag() { | |
int i, j; | |
for (i = 0; i < 9; i++) { | |
for (int j = 0; j < 9; ++j) { | |
if (j == 0)mask[i][j] = (9 - i) % 9; | |
else if (j == 3)mask[i][j] = (15 - i) % 9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Combine the multiple images into a single integrated image | |
void render() { | |
int x, y, z, v, m, n; | |
z = COL * 3; | |
for (x = 0; x < ROW; x++) { | |
for (y = 0; y < z; y++) { | |
back_buf[x][y] = image[mask[x % 9][y % 9]][x][y]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONFIG = { | |
'Arial Black' : 'ENG', | |
'Arial' : 'ENG', | |
'Calibri' : 'ENG', | |
'Cambria' : 'ENG', | |
'Candara' : 'ENG', | |
'Comic Sans MS' : 'ENG', | |
'Constantia' : 'ENG', | |
'Corbel' : 'ENG', | |
'Georgia' : 'ENG', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clang++ -framework glut -framework opengl main.cpp -o main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
font-family: "PingFang SC" !important; | |
font-size: 18px !important | |
} | |
aside { | |
display: none !important; | |
} | |
main { | |
width: auto !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include "Mutex.h" | |
#include "NonCopyable.h" | |
template <typename T> | |
class Singleton : NonCopyable { | |
public: | |
static T& instance() { | |
if (val_ == NULL) { | |
MutexLockGuard lock(mutex_); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <vector> | |
void bubble_sort(std::vector<int>& nums) { | |
for (int i = 0; i < nums.size(); i++) { | |
for (int j = nums.size() - 1; j > i; j--) { | |
if (nums[j] < nums[i]) { | |
std::swap(nums[i], nums[j]); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <vector> | |
void selection_sort(std::vector<int>& nums) { | |
for (int i = 0; i < nums.size(); i++) { | |
int min = i; | |
for (int j = i + 1; j < nums.size(); j++) { | |
if (nums[j] < nums[min]) { | |
min = j; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <vector> | |
void insertion_sort(std::vector<int>& nums) { | |
for (int i = 0; i < nums.size(); i++) { | |
int j = i; | |
while (j > 0 && nums[j] < nums[j - 1]) { | |
std::swap(nums[j], nums[j - 1]); | |
j--; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <vector> | |
void quick_sort(std::vector<int>& nums, int l, int r) { | |
if (l >= r) { | |
return; | |
} | |
// pivot is left | |
int tmp = l; |
OlderNewer