結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー vjudge1
提出日時 2025-02-05 01:14:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,460 bytes
コンパイル時間 4,084 ms
コンパイル使用メモリ 219,236 KB
実行使用メモリ 287,360 KB
最終ジャッジ日時 2025-02-05 01:14:50
合計ジャッジ時間 21,779 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

// ?????? ????? ??????????? ???????????
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define pb push_back
#define all(x) x.begin(), x.end()
#define int long long
#define py cout << "YES\n";
#define pn cout << "NO\n";
#define forn(a, b) for (int i = a; i < b; i++)
#define nl cout << endl;
#define pii pair<int, int>
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
const int mod = 1e9 + 7;

void solve();

signed main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tc = 1;

    while (tc--)
        solve();

    return 0;
}

void solve()
{
    int n, a, b, c;
    cin >> n >> a >> b >> c;

    set<int> st;
    int count = 0;

    int i = 0;
    while (a * ++i <= n)
    {
        int number = a * i;
        if (st.find(number) != st.end())
            continue;

        st.insert(number);
        count++;
    }
    i = 0;

    while (b * ++i <= n)
    {
        int number = b * i;
        if (st.find(number) != st.end())
            continue;

        st.insert(number);
        count++;
    }
    i = 0;

    while (c * ++i <= n)
    {
        int number = c * i;
        if (st.find(number) != st.end())
            continue;

        st.insert(number);
        count++;
    }

    cout << count;
}
0