{{ message }}

Instantly share code, notes, and snippets.

🎯
Focusing

# Yizheng Zhang Privilger

🎯
Focusing
Created Sep 6, 2020
a code run before main() function.
View exec_before_main.cpp
 #include #include #include #include using namespace std; __attribute((constructor))void before(){ cout << "before main" << endl; }
Created Mar 4, 2020

View acwing_166.cpp
 #include #include #include using namespace std; const int N = 9, M = 1 << N; int ones[M], map[M]; // ones存的是， 一个数，的二进制中，有几个1
Created Feb 26, 2020
Matlab编程技巧
View magic_matlab.m
 %% 变量的变量 data = [2, 3, 4, 5]; for m = 1 : 4 name_string = ['s' num2str(m) ' = data' '(' num2str(m) ')']; eval(name_string) end
Created Feb 19, 2020
C++ STL 使用技巧
View a.cpp
 /* 元素去重 */ vector alls; //存储所有值 sort(alls.begin(), alls.end()); //排序 alls.erase(unique(alls.begin(), alls.end()), alls.end()); //去除重复元素
Last active Mar 4, 2020

View bit_operate.cpp
 /* 整数n的二进制表示下第k为是几 右移k位 然后 与运算1 */ n >> k & 1; /* x -> 表示整数n的二进制,但实际使用的时候, 传入n就行 lowbit(x): 返回x的最后一位1
Last active Feb 18, 2020
C++大数运算去除前导0
View big_num_operate.cpp
 /* C++大数运算去除前导0 vector c; // c的数据类型 如果要用c表示一个大数, eg: "123456" 则存储方式为（倒着存）: [6, 5, 4, 3, 2, 1] */
Created Sep 1, 2018 — forked from Tiryoh/ros_kinetic_install_raspizero.bash
ROS Kinetic installation on Raspberry Pi Zero/Raspberry Pi Zero W
View ros_kinetic_install_raspizero.bash
 sudo apt-get update sudo apt-get install -y build-essential gdebi mkdir -p ~/tmp wget https://github.com/nomumu/Kinetic4RPiZero/releases/download/v_2017-10-15/rpi-zerow-kinetic_1.0.0-1_armhf.zip unzip rpi-zerow-kinetic_1.0.0-1_armhf.zip sudo gdebi rpi-zerow-kinetic_1.0.0-1_armhf.deb sudo /opt/ros/kinetic/initialize.sh