結果

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll lcm3(ll a,ll b,ll c) {
    ll k=a/__gcd(a,b)*b;
    return c/__gcd(c,k)*k;
}
int main() {
    //freopen("multiple.in","r",stdin);
    //freopen("multiple.out","w",stdout);
    ll n,a,b,c; cin>>n>>a>>b>>c;
    cout<<n/a+n/b+n/c-n/(a/__gcd(a,b)*b)-n/(a/__gcd(a,c)*c)-n/(b/__gcd(b,c)*c)+n/lcm3(a,b,c);
    return 0;
}
0