結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2023-10-27 13:11:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 1,588 ms |
コンパイル使用メモリ | 195,344 KB |
最終ジャッジ日時 | 2025-02-17 14:07:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> #define rep(i, p, n) for (ll i = p; i < (ll)(n); i++) #define rep2(i, p, n) for(ll i = p; i >= (ll)(n); i-- ) using namespace std; using ll = long long; double pi=3.141592653589793; const long long inf=2*1e9; const long long linf=8*1e18; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } //atcoder #include <atcoder/modint> #include <atcoder/dsu> using namespace atcoder; using mint1 = modint1000000007; using mint2 = modint998244353; int main() { ll N, A, B, C; cin >> N >> A >> B >> C; ll ans=0; ans+=N/A; ans+=N/B; ans+=N/C; ll D=B*C/gcd(B, C); ans-=N/D; D=B*A/gcd(B, A); ans-=N/D; D=A*C/gcd(A, C); ans-=N/D; D=D*B/gcd(B, D); ans+=N/D; cout << ans; }