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

Depends on

Code

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

#include "../src/math/Divisor.hpp"
#include <iostream>

int main() {
    int a, b, c;
    std::cin >> a >> b >> c;
    int ans = 0;
    for (auto div : zawa::divisor(c)) {
        ans += a <= div and div <= b;
    }
    std::cout << ans << std::endl;
}
#line 1 "test/aoj_itp1_3_d.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/3/ITP1_3_D"

#line 2 "src/math/Divisor.hpp"

#include <vector>
#include <algorithm>

namespace zawa {

    std::vector<long long> divisor(long long x) {
        std::vector<long long> res;

        for (long long i = 1 ; i * i <= x ; i++) {
            if (x % i) continue;
            res.emplace_back(i);
            if (i * i != x) res.emplace_back(x / i);
        }
        std::sort(res.begin(), res.end());

        return res;
    }

}// namespace zawa
#line 4 "test/aoj_itp1_3_d.test.cpp"
#include <iostream>

int main() {
    int a, b, c;
    std::cin >> a >> b >> c;
    int ans = 0;
    for (auto div : zawa::divisor(c)) {
        ans += a <= div and div <= b;
    }
    std::cout << ans << std::endl;
}
Back to top page