Algorithm library (C++)
Setup
1. Clone this repository
# clone with submodules
$ git clone --recurse-submodules https://github.com/hareku/cpp-algorithm
VSCode Remote Container
or Install dependencies
2. Open with You can easily start with VSCode Remote Container without installing dependencies.
If you develop locally or want to use other editors, install some dependencies. Check out Dockerfile.
main.cpp
and run it
3. Build # create main.cpp
$ cp main.template.cpp main.cpp
# build main.cpp
$ make a.out
# execute binary
$ ./a.out
# bundle `main.cpp` and including libraries for submission (e.g AtCoder)
$ make bundle.cpp
$ cat bundle.cpp # bundled code
How to use algorithm library
Example code for lib/math/divisors.hpp
#include <bits/stdc++.h>
#include "lib/math/divisors.hpp"
using namespace std;
int main() {
int N; cin >> N;
vector<long long> divisors = lib::math::divisors(N);
for(int i = 0; i < int(divisors.size()); ++i) {
cout << divisors[i] << endl;
}
return 0;
}
How to test
This library is tested by Verification Helper.
# run all tests
$ oj-verify all
# run specific test
$ oj-verify run test/math/primes.test.cpp