結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー hkr
提出日時 2017-02-22 23:14:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 64,436 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 19:31:09
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 14 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
int main() {
    ll n;
    vector<ll> a(3);
    cin >> n >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());

    ll ans = n/a[0];
    if(a[1]%a[0]) ans += n/a[1] - n/(a[0]*a[1]);
    if(a[2]%a[0] && a[2]%a[1]) ans += n/a[2] - n/(a[2]*a[0]) - n/(a[2]*a[1]) + n/(a[0]*a[1]*a[2]);

    cout << ans << endl;
}
0