結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define popcount __builtin_popcountll
const int MOD = 1e9 + 7;

void swapp(int &a, int &b) {
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
}

int mul(int a, int b) {
    if (log10l(a) + log10l(b) > 18.3) return 3e18;
    return a * b;
}

#define forn(i, a, b) for (int i = a; i < b; i++)

bool comp(pair<int, int> a, pair<int, int> b) {
    if (a.first == b.first) {
        return a.second > b.second;
    }
    return a.first < b.first;
}

void solve() {
    int ta ; 
    cin >> ta; 
    int a,b,c;
    cin >> a>> b >> c; 
    int cnt = 0 ;
    cnt = ta/a + ta/b + ta/c - ta/(lcm(a,b)) - ta /(lcm(a,c)) - ta/(lcm(b,c)) + ta/(lcm(a,lcm(b,c)));
    cout<<cnt<<"\n";
}

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