結果

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

ソースコード

diff #

//PLEASE GOD MAKE THIS CODE ACCEPTED SOLUTION
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define int long long
#define forn(i,a,n) for(int i = a; i<n; i++)
#define fornr(i,a,n) for(int i = n-1; i>=a; i--)
#define print(a) cout<<a<<"\n";
#define printarr(a)                 \
    forn(i,0,a.size()) cout<<a[i]<<" ";\
    cout<<endl;
 
#define pb push_back
#define all(a) a.begin(), a.end()
#define sorted(a) is_sorted(all(a))
#define vi vector<int>
#define vc vector<char>
#define vd vector<double>
#define vs vector<string>
#define vb vector<bool>
#define vpib vector<pair<int,bool>>
#define vpis vector<pair<int,string>>
#define vpii vector<pair<int,int>>
#define vpic vector<pair<int,char>>
#define vvi vector<vector<int>>
#define vpss vector<pair<string,string>>
#define vvc vector<vector<char>>

const ll MOD = 1e9 + 7;


void solve(){
    int n, a, b, c;
    cin>>n>>a>>b>>c;
    int count = 0;
    int aMul = n/a;
    int bMul = n/b;
    int cMul = n/c;
    //remove commons??
    int abCommon = n/lcm(a,b); //lcm multiple hi hoongay?
    int bcCommon = n/lcm(b,c);
    int acCommon = n/lcm(a,c);

    cout<<aMul+bMul+cMul-abCommon-bcCommon-acCommon+(n/lcm(a,lcm(b,c)));
} 

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}
0