結果
| 問題 | No.546 オンリー・ワン | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-09-07 00:46:55 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 3,328 bytes | 
| コンパイル時間 | 2,191 ms | 
| コンパイル使用メモリ | 195,252 KB | 
| 最終ジャッジ日時 | 2025-01-24 08:40:22 | 
| ジャッジサーバーID (参考情報) | judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 7 | 
ソースコード
#line 1 "/workspaces/compro/lib/template.hpp"
#line 1 "/workspaces/compro/lib/Assert/Assert.hpp"
#include <cassert>
#include <iostream>
#include <string>
#ifndef MY_ASSERT
#define MY_ASSERT
#ifdef LOCAL
#define ASSERT_MSG(expr, msg)                                                                                          \
  do {                                                                                                                 \
    if (!(expr)) {                                                                                                     \
      std::cerr << msg << std::endl;                                                                                   \
      assert(expr);                                                                                                    \
    }                                                                                                                  \
  } while (0)
#define FAIL ASSERT_MSG(false, "到達しない想定の場所に到達しました")
#else
#define ASSERT_MSG(...) (void)0
#define FAIL (void)0
#endif
#endif
#line 2 "/workspaces/compro/lib/io/vector.hpp"
#include <vector>
#ifndef IO_VECTOR
#define IO_VECTOR
template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}
template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}
#endif
#line 5 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define RREP(i, n) for (int i = (n - 1); i >= 0; i--)
#define RFOR(i, m, n) for (int i = (n - 1); i >= (m); i--)
#define ALL(v) std::begin(v), std::end(v)
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<
using namespace std;
template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}
template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}
// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}
#line 2 "main.cpp"
const ll INF = 1e9;
long long solve(int N, long long L, long long H, const std::vector<long long> &C) {
  auto f = [&](ll X) -> ll {
    ll ret = 0;
    FOR(s, 1, 1 << N) {
      ll l = 1;
      REP(i, N) {
        if ((s >> i) % 2 == 0)
          continue;
        l = lcm(l, C[i]);
        if (l > INF)
          break;
      }
      ll tmp = X / l;
      ll cnt = __builtin_popcount(s);
      ret += cnt % 2 == 1 ? cnt * tmp : -cnt * tmp;
    }
    return ret;
  };
  return f(H) - f(L - 1);
}
// generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator)
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  long long L, H;
  std::cin >> N;
  std::vector<long long> C(N);
  std::cin >> L >> H;
  for (int i = 0; i < N; ++i) {
    std::cin >> C[i];
  }
  auto ans = solve(N, L, H, C);
  std::cout << ans << '\n';
  return 0;
}
            
            
            
        