Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // OK B region first tour 17/18
- # include <iostream>
- # include <cmath>
- using namespace std;
- int64_t check(double x) {
- double const EPS = 0.0000001;
- if (abs(ceil(x) - x) <= EPS) {
- return ceil(x);
- } else {
- return floor(x);
- }
- }
- int main() {
- int64_t a, b, k;
- cin >> a;
- cin >> b;
- cin >> k;
- int64_t res = 0;
- auto example = static_cast<int64_t> (check(pow(b, 1 / 3.0)));
- for (size_t i = static_cast<int64_t> (ceil(pow(a, 1 / 3.0))); i <= static_cast<int64_t> (check(pow(b, 1 / 3.0))); i++) {
- int64_t left = max(static_cast<int64_t> (ceil(pow(max(pow(i, 3) - k, 1.0), 1 / 2.0))), static_cast<int64_t> (ceil(pow(a, 1 / 2.0))));
- int64_t right = min(static_cast<int64_t> (check(pow(pow(i, 3) + k, 1 / 2.0))), static_cast<int64_t> (check(pow(b, 1 / 2.0))));
- res += max(right - left + 1, static_cast<int64_t> (0));
- }
- cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement