結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー | cao bi |
提出日時 | 2022-06-01 08:23:28 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 5,541 bytes |
コンパイル時間 | 2,448 ms |
コンパイル使用メモリ | 202,760 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 01:27:02 |
合計ジャッジ時間 | 3,822 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 3 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 3 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 3 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 3 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 3 ms
5,376 KB |
testcase_26 | AC | 2 ms
5,376 KB |
testcase_27 | AC | 3 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 2 ms
5,376 KB |
testcase_30 | AC | 2 ms
5,376 KB |
testcase_31 | AC | 2 ms
5,376 KB |
testcase_32 | AC | 2 ms
5,376 KB |
testcase_33 | AC | 2 ms
5,376 KB |
testcase_34 | AC | 3 ms
5,376 KB |
testcase_35 | AC | 2 ms
5,376 KB |
testcase_36 | AC | 2 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rng(i, a, b) for (int i = int(a); i < int(b); ++i) #define rep(i, b) rng(i, 0, b) #define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); --i) #define per(i, b) gnr(i, 0, b) #define all(obj) begin(obj), end(obj) #define allr(obj) rbegin(obj), rend(obj) #define sz(x) (int)(x).size() #define cinv(a) rep(i, sz(a)) cin >> a[i] #define debug(a) rep(i, sz(a)) cout << a[i] << " \n"[i == sz(a) - 1] #define show(x) cerr << #x << " = " << x << endl; #define pb push_back typedef long long ll; typedef pair<ll, ll> pl; typedef vector<pl> vpl; typedef vector<vpl> vvpl; typedef pair<int, int> pi; typedef vector<pi> vp; typedef vector<vp> vvp; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; const int INF = 1e9 + 9; const ll LINF = 3e18; const long double eps = 1e-10; const char nl = '\n'; template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &it : v) is >> it; return is; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (int i = 0; i < sz(v); ++i) os << v[i] << " \n"[i == sz(v) - 1]; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<pair<T, T>> &v) { for (auto &it : v) os << it.first << " " << it.second << nl; return os; } template <typename T> ostream &operator<<(ostream &os, const set<T> &s) { for (auto it : s) os << it << " \n"[it == *rbegin(s)]; return os; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp) { for (auto &it : mp) os << it.first << " " << it.second << nl; return os; } template <typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>; const int di[] = {0, 1, 0, -1}; const int dj[] = {1, 0, -1, 0}; // const int MOD = 1e9 + 7; const int MOD = 998244353; struct mint { ll x; mint(ll x = 0) : x((x % MOD + MOD) % MOD) { } mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= MOD) x -= MOD; return *this; } mint &operator-=(const mint a) { if ((x += MOD - a.x) >= MOD) x -= MOD; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= MOD; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint &operator++() { return *this += 1; } mint operator++(int) { mint res(*this); ++*this; return res; } mint &operator--() { return *this -= 1; } mint operator--(int) { mint res(*this); --*this; return res; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } mint inv() const { return pow(MOD - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } typedef vector<mint> vm; typedef vector<vm> vvm; ll power(ll a, ll b, int mod = MOD) { return b ? power(a * a % mod, b / 2, mod) * (b % 2 ? a : 1) % mod : 1; } ll inv(ll a, int mod = MOD) { return power(a, mod - 2); } ll nCk(int n, int k, int mod = MOD) { ll x = 1, y = 1; for (int i = 1; i <= k; ++i) { x = x * (n - i + 1) % mod; y = y * i % mod; } return x * power(y, mod - 2, mod) % mod; } struct UF { vi d; UF(int n = 0) : d(n, -1) { } int root(int x) { if (d[x] < 0) return x; return d[x] = root(d[x]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (d[x] > d[y]) swap(x, y); d[x] += d[y]; d[y] = x; return true; } bool same(int x, int y) { return root(x) == root(y); } int size(int x) { return -d[root(x)]; } }; struct Edge { ll to, cost; Edge(ll to, ll cost) : to(to), cost(cost) { } }; clock_t startTime; void getCurrentTime() { cout << (double)(clock() - startTime) / CLOCKS_PER_SEC << nl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); // startTime = clock(); // getCurrentTime(); ll n, a, b, c; cin >> n >> a >> b >> c; ll ab = lcm(a, b), bc = lcm(b, c), ca = lcm(c, a); ll abc = lcm(ab, c); cout << n/a + n/b + n/c - n/ab - n/bc - n/ca + n/abc << nl; }