Skip to content

Instantly share code, notes, and snippets.

View bruceoutdoors's full-sized avatar
🧗

Lee Zhen Yong bruceoutdoors

🧗
View GitHub Profile
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
using namespace std;
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> xd;
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
double PI = acos(0) * 2;
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> ivec;
ivec polynomialMultiply(const ivec &a, const ivec &b)
{
int N = 2 * a.size() - 1;
@bruceoutdoors
bruceoutdoors / krita-builder.bat
Last active September 25, 2016 04:01
Krita build batch script.
:: =================== READ ME BEFORE USE!! ============================
:: This build script assumes that cmake, python, TDM-GCC (with OpenMP)
:: is in your environment paths.
::
:: It also uses Ninja to build Krita (it builds considerably faster!).
:: Make sure that ninja executable is in your PATHS also.
::
:: Run this script in administrator mode. Make sure you have a stable
:: internet connection.
::
@bruceoutdoors
bruceoutdoors / hill-cipher.sh
Last active June 2, 2022 21:33
Hill Cipher - use via "hill-decrypt.sh" and "hill-encrypt.sh"
#!/bin/bash
. matrix.sh
. mods.sh
. translator.sh
function hill_decrypt {
key=${1// /} # clear spaces from key
if [ ${#key} -lt 4 ];
then
% BEGIN -- SETUP DOCUMENT (OVERLEAF) --
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\usepackage[pdftex]{graphicx}
\addbibresource{ref.bib}
\let\cite\parencite
@bruceoutdoors
bruceoutdoors / knapsack-dp.cpp
Last active December 13, 2015 13:42
Dynamic programming solution to http://www.spoj.com/problems/KNAPSACK/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> v, c;
int S, N; cin >> S >> N;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v, c;
int B(int i, int w)
{
@bruceoutdoors
bruceoutdoors / knapsack-select.cpp
Last active December 13, 2015 13:41
Select items from knapsack 1-0 problem - www.spoj.com/problems/KNAPSACK/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v, c;
vector< vector<int> > DP;
void pick(int i, int w)