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/input2.test.cpp

Depends on

Code

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

#include "../src/template/input.hpp"

using namespace zawa::input;

int main() {
    int n, m, l; 
    in(n, m, l);
    std::vector as(n, std::vector(m, 0));
    for (auto& a : as) {
        in(a);
    }
    std::vector bs(m, std::vector(l, 0));
    for (auto& b : bs) {
        in(b);
    }
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < l ; j++) {
            long long val = 0;
            for (int k = 0 ; k < m ; k++) {
                val += as[i][k] * bs[k][j];
            }
            std::cout << val << (j + 1 == l ? '\n' : ' ');
        }
    }
}
#line 1 "test/input2.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/7/ITP1_7_D"

#line 2 "src/template/input.hpp"

#include <iostream>
#include <utility>
#include <vector>

namespace zawa::input {

template <typename T> 
void in(T& res) { std::cin >> res; }

template <typename Head, typename... Tail>
void in(Head& head, Tail&... tail) { in(head); in(tail...); }

template <typename T, typename U>
void in(std::pair<T, U>& res) { in(res.first); in(res.second); }

template <typename T>
void in(std::vector<T>& res) { for (auto& r : res) { in(r); } }

} // namespace zawa::input
#line 4 "test/input2.test.cpp"

using namespace zawa::input;

int main() {
    int n, m, l; 
    in(n, m, l);
    std::vector as(n, std::vector(m, 0));
    for (auto& a : as) {
        in(a);
    }
    std::vector bs(m, std::vector(l, 0));
    for (auto& b : bs) {
        in(b);
    }
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < l ; j++) {
            long long val = 0;
            for (int k = 0 ; k < m ; k++) {
                val += as[i][k] * bs[k][j];
            }
            std::cout << val << (j + 1 == l ? '\n' : ' ');
        }
    }
}
Back to top page