zawatins-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub zawa-tin/zawatins-library

:heavy_check_mark: test/Pascal-Triangle.test.cpp

Depends on

Code

#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"

#include "../src/math/Pascal-Triangle.hpp"
#include <iostream>

int main() {
    std::cout << "Hello World" << std::endl;
}

/*
 * ABC254-B Practical Computing
 * https://atcoder.jp/contests/abc254/submissions/35829847
 */
#line 1 "test/Pascal-Triangle.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/1/ITP1_1_A"

#line 2 "src/math/Pascal-Triangle.hpp"

#include <vector>

namespace zawa {

template <class T>
class Pascal_Triangle {
private:
    std::vector<std::vector<T>> table;
public:
    Pascal_Triangle(int max_n, int max_r)
        : table(max_n + 1, std::vector<T>(max_r + 1)) {
        table[0][0] = 1;
        for (int i = 1 ; i <= max_n ; i++) {
            for (int j = 1 ; j <= max_r ; j++) {
                table[i][j] = table[i - 1][j - 1] + table[i - 1][j];
            }
        }
    }

    T ncr(int n, int r) {
        return table.at(n).at(r);
    }
};

} // namespace zawa
#line 4 "test/Pascal-Triangle.test.cpp"
#include <iostream>

int main() {
    std::cout << "Hello World" << std::endl;
}

/*
 * ABC254-B Practical Computing
 * https://atcoder.jp/contests/abc254/submissions/35829847
 */
Back to top page