Skip to content

Instantly share code, notes, and snippets.

@juanfal
juanfal / t10e26.longNatural.cpp
Created Jan 22, 2022
Long integers handled with strings
View t10e26.longNatural.cpp
// t10e26.longNatural.cpp
// juanfc 2022-01-17
// Juan Falgueras, 1997-11-25 al 2003-12-05
//
#include <iostream>
#include <iomanip>
using namespace std;
void test(string s1, string s2);
@juanfal
juanfal / t12e13.queens.cpp
Created Jan 22, 2022
Eight queens problem checking
View t12e13.queens.cpp
// t12e13.queens.cpp
// juanfc 2022-01-19
//
#include <iostream>
#include <array>
using namespace std;
const int N = 8;
const int NQUEENS = 8;
@juanfal
juanfal / t12e14.coxeter.cpp
Created Jan 22, 2022
Coxeter formula to build Magic Squares (odd sizes)
View t12e14.coxeter.cpp
// t12e14.coxeter.cpp
// juanfc 2022-01-22
// juanfc 26/1/02, 2006-12-14, 2019-01-10
//
//
// magicsquareSTL.cpp
// https://gist.github.com/9273b8a29955e043d26596b440e9b756
// \ej\label{magicsq}\dificil\dificil\textbf{Magic Squares}\\
// A \href{https://en.wikipedia.org/wiki/Magic_square}{magic square} is a
View t12e15.knightTourCheck.cpp
// t12e15.knightTourCheck.cpp
// juanfc 2021-12-19
//
#include <iostream>
#include <array>
using namespace std;
const int N = 8;
typedef array<array<int,N>,N> TChessboard;
@juanfal
juanfal / t11e07.polynomials.cpp
Last active Jan 17, 2022
polynomials with open arrays
View t11e07.polynomials.cpp
// t11e07.polynomials.cpp
// juanfc 2018-12-17
// https://gist.github.com/baf068a06eafb1ecba8a584fe375b780
#include <array>
#include <iostream>
using namespace std;
const int N = 100;
struct TMono {
View t11e06.OpenArray.cpp
// t11e06.OpenArray.cpp
// juanfc 2022-01-16
//
#include <array>
#include <iostream>
using namespace std;
const int N = 100;
typedef array<int, N> TVector;
View t11e05.TStudent.cpp
// t11e05.TStudent.cpp
// juanfc 2022-01-16
//
#include <iostream>
#include <array>
using namespace std;
View t11e04.TPatient.cpp
// t11e04.TPatient.cpp
// juanfc 2022-01-16
//
#include <iostream>
#include <array>
using namespace std;
const int NBLOPRE = 24*31;
@juanfal
juanfal / t11e03.complexnumbers.cpp
Created Jan 17, 2022
struct complex number basic arithmetics
View t11e03.complexnumbers.cpp
// t11e03.complexnumbers.cpp
// juanfc 2022-01-16
//
#include <iostream>
using namespace std;
struct TComp {
float re, im;
};
@juanfal
juanfal / t10e24.rom2int.cpp
Last active Jan 16, 2022
roman numbers value
View t10e24.rom2int.cpp
// t10e24.rom2int.cpp
// juanfc 2022-01-16
// https://gist.github.com/f47e281ad205395051fd1aaf8f0aa13a
#include <iostream>
using namespace std;
void test(string s);
int main()