結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー legosukelegosuke
提出日時 2020-11-24 06:31:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 199,820 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-01 00:47:58
合計ジャッジ時間 3,421 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 WA -
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "test/01_Math/01_NumberTheory/03.01_yukicoder-0316.test.cpp"
#define PROBLEM "https://yukicoder.me/problems/no/316"
#line 1 "template/template.hpp"
#include <bits/stdc++.h>
using namespace std;
#line 3 "01_Math/01_NumberTheory/02.01_gcd.hpp"

/**
 * @brief 最大公約数
 * @docs docs/gcd.md
 */
uint64_t gcd(uint64_t a, uint64_t b) {
    while (b) {
        uint64_t c = a % b;
        a = b;
        b = c;
    }
    return a;
}
#line 3 "01_Math/01_NumberTheory/03.01_lcm.hpp"

/**
 * @brief 最小公倍数
 * @docs docs/lcm.md
 */
uint64_t lcm(uint64_t a, uint64_t b) {
    return a / gcd(a, b) * b;
}
#line 4 "test/01_Math/01_NumberTheory/03.01_yukicoder-0316.test.cpp"

long long num(int n, int x) {
    return n / x;
}

int main() {
    long long N, a, b, c;
    cin >> N >> a >> b >> c;
    long long ans = num(N, a) + num(N, b) + num(N, c);
    ans -= num(N, lcm(a, b)) + num(N, lcm(b, c)) + num(N, lcm(c, a));
    ans += num(N, lcm(a, lcm(b, c)));
    cout << ans << endl;
}
0