結果

問題 No.2480 Sequence Sum
ユーザー rei-artistrei-artist
提出日時 2023-09-23 02:16:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,298 bytes
コンパイル時間 7,558 ms
コンパイル使用メモリ 349,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-16 02:42:18
合計ジャッジ時間 8,257 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using namespace atcoder;
#ifdef DEBUG
#include "_debug.h"
#else
#define tr(...)
#define trp(a, ...) a
#endif

typedef long long ll;
typedef unsigned long long ull;
template <typename T> using v = vector<T>;
template <typename T> using vv = v<v<T>>;
template <typename T> using vvv = v<vv<T>>;
template <typename T> using vvvv = v<vvv<T>>;

#define LR(i, n) for (int i = 0; i < (n); i++)
#define LR2(i, s, e) for (int i = (s); i < (e); i++)
#define RL(i, n) for (int i = (n)-1; i >= 0; i--)
#define RL2(i, s, e) for (int i = (e)-1; i >= (s); i--)
#define ALL(a) (a).begin(), (a).end()

template <typename, typename = void_t<>> struct has_val : false_type {};
template <typename T>
struct has_val<T, void_t<decltype(declval<T>().val())>> : true_type {};
template <typename T, enable_if_t<has_val<T>::value, nullptr_t> = nullptr>
ostream &operator<<(ostream &out, const T &o) {
  return out << o.val();
}
ostream &operator<<(ostream &out, const string &v) {
  for (auto i = v.cbegin(); i != v.cend(); i++) out << *i;
  return out;
}
template <class T, size_t N>
ostream &operator<<(ostream &out, const array<T, N> &v) {
  for (auto i = v.cbegin(); i != v.cend(); i++)
    out << (i != v.cbegin() ? " " : "") << *i;
  return out;
}
template <template <class...> class C, class... T>
ostream &operator<<(ostream &out, const C<T...> &v) {
  for (auto i = v.cbegin(); i != v.cend(); i++)
    out << (i != v.cbegin() ? " " : "") << *i;
  return out;
}
template <size_t I = 0, typename... Tp>
inline enable_if_t<I == sizeof...(Tp), void> in_tuple(
    istream &in, tuple<Tp...> &t) {}
template <size_t I = 0, typename... Tp>
    inline enable_if_t <
    I<sizeof...(Tp), void> in_tuple(istream &in, tuple<Tp...> &t) {
  in >> get<I>(t);
  in_tuple<I + 1, Tp...>(in, t);
}
template <class... Args> istream &operator>>(istream &in, tuple<Args...> &t) {
  in_tuple(in, t);
  return in;
}
template <class A, class B> istream &operator>>(istream &in, pair<A, B> &o) {
  in >> o.first, in >> o.second;
  return in;
}
template <class T, size_t N> istream &operator>>(istream &in, array<T, N> &v) {
  LR(i, N) in >> v[i];
  return in;
}
template <class T> istream &operator>>(istream &in, vector<T> &v) {
  LR(i, v.size()) in >> v[i];
  return in;
}

template <typename T1, typename T2> T1 div_ceil(T1 x, T2 y) {
  return (x + y - 1) / y;
}
template <typename T1, typename T2> T1 div_floor(T1 x, T2 y) {
  return x / y - (x % y != 0 && (y < 0) != (x < 0));
}
template <typename A, size_t N, typename T>
void fill_array(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename I, typename S>
void assign(vector<T> &v, const I &val, const S n) {
  v.assign(n, val);
}
template <typename V, typename I, typename S, typename... A>
void assign(vector<V> &vec, const I &val, const S &n, const A... tail) {
  vec.resize(n);
  for (auto &v : vec) assign(v, val, tail...);
}
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}
template <template <class...> class C, class T> inline T pop_back(C<T> &c) {
  T res = move(c.back());
  c.pop_back();
  return res;
}
template <template <class...> class C, class T> inline T pop_front(C<T> &c) {
  T res = move(c.front());
  c.pop_front();
  return res;
}
void yesno(bool b) { cout << (b ? "Yes" : "No") << endl; }

struct in {
  template <class T> operator T() const {
    T a;
    cin >> a;
    return a;
  }
};
struct vin {
  size_t s1;
  explicit vin(size_t s1) : s1(s1){};
  template <class C> operator v<C>() const {
    v<C> a(s1);
    cin >> a;
    return a;
  }
};
struct vvin {
  size_t s1, s2;
  vvin(size_t s1, size_t s2) : s1(s1), s2(s2){};
  template <class C> operator vv<C>() const {
    vv<C> a(s1, v<C>(s2));
    cin >> a;
    return a;
  }
};

template <int N = 1> struct mkv {
  const v<int> &sizes;
  const optional<any> &value;
  mkv(const v<int> &sizes, const optional<any> &value = nullopt)
      : sizes(sizes), value(value) {}
  template <class C> operator v<C>() {
    int n = sizes[sizes.size() - N];
    if (N == 1) {
      return value.has_value() ? v<C>(n, any_cast<C>(value.value())) : v<C>(n);
    } else {
      return v<C>(n, (C)mkv<N - 1>(sizes, value));
    }
  }
};
template <> struct mkv<0> {
  mkv(const v<int> &sizes, const optional<any> &value = nullopt) {}
  template <class T> operator T() { return T(); }
};

const int INT_INF = 0x3fffffff;
const ll LL_INF = 0x1fffffffffffffffll;
const double EPS = 0.0000001;
int cmp_eps(double x, double y) {
  return (x > y + EPS) ? 1 : (y > x + EPS) ? -1 : 0;
}
using mint = modint998244353;

struct hiki {
  int N = in();

  hiki() {}
  void komoru() {
    ll ans = 0;
    for (int i = 2; i * (i - 1) <= N; i++) {
      int x = (N - i) % (i - 1);
      int d = 0;
      d += div_ceil((N - i - x * i), i * (i - 1));
      tr(i, d, x);
      ans += d;
    }
    cout << ans << endl;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  hiki().komoru();

  return 0;
}

//
0