結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int gcd(int a, int b) {
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}

int lcm(int a, int b){
    return (a * b) / gcd(a, b);
}

int main(){
    int n, a, b, c, x;
    cin >> n >> a >> b >> c;
    
    x = ((n/a)+(n/b)+(n/c))-(n/lcm(a,b)+n/lcm(b,c)+n/lcm(c,a)) + n/lcm(lcm(a,b),c);

    cout << x;
}
0