結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー vjudge1
提出日時 2025-02-05 02:03:15
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,359 bytes
コンパイル時間 5,377 ms
コンパイル使用メモリ 278,736 KB
実行使用メモリ 413,440 KB
最終ジャッジ日時 2025-02-05 02:03:38
合計ジャッジ時間 22,588 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25 WA * 1 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define popcount __builtin_popcountll
int const MOD = 1e9 + 7;

void swapp(int &a, int &b) {
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
}

int mul(int a, int b) {
    if (log10l(a) + log10l(b) > 18.3) return 3e18;
    return a * b;
}

#define forn(i, a, b) for (int i = a; i < b; i++)

bool comp(pair<int, int> a, pair<int, int> b) {
    if (a.first == b.first) {
        return a.second > b.second;
    }
    return a.first < b.first;
}

void solve() {
    int n;
    cin>>n;
    int a,b,c;
    cin>>a>>b>>c;
    set<int>st;
    int i = 1;
    int m = a;
    while(a <= n){
        a = m * i;
        if(c > n){
            break;
        }
        i++;
        st.insert(a);
    }
    i = 1;
    m = b;
    while(b <= n){
        b = m * i;
        if(b > n){
            break;
        }
        i++;
        st.insert(b);
    }
    i = 1;
    m = c;
    while(c <= n){
        c = m * i;
        if(c > n){
            break;
        }
        i++;
        st.insert(c);
    }
    cout<<st.size() - 1<<"\n";
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    // cin >> t;
    forn(i,0,t){
        solve();
    }
    return 0;
}
0