結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2023-02-16 00:21:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,923 bytes |
コンパイル時間 | 2,165 ms |
コンパイル使用メモリ | 193,292 KB |
最終ジャッジ日時 | 2025-02-10 15:48:01 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sz(v) (int)(v.size()) #define all(v) (v.begin(),v.end()) #define uniq(v) (v).erase(unique(all(v)),(v).end()) #define mem1(a) memset(a,-1,sizeof(a)) #define mem0(a) memset(a,0,sizeof(a)) constexpr int pct(int x) { return __builtin_popcount(x); } constexpr int bits(int x) { return 31 - __builtin_clz(x); } const long long INF=1e18; const int32_t M=1e9+7; const int32_t MM=998244353; const long double pi = 3.14159265358979323846; template<typename T, typename = void> struct is_iterable : false_type {}; template<typename T> struct is_iterable<T, void_t<decltype(begin(declval<T>())),decltype(end(declval<T>()))>> : true_type {}; template<typename T> typename enable_if<is_iterable<T>::value&&!is_same<T, string>::value,ostream&>::type operator<<(ostream &cout, T const &v); template<typename T> typename enable_if<is_iterable<T>::value&&!is_same<T, string>::value,ostream&>::type operator<<(ostream &cout, T const &v) { cout << "["; for (auto it = v.begin(); it != v.end();) { cout << *it; if (++it != v.end()) cout << ", "; } return cout << "]"; } template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.first << ", " << p.second << ")"; } template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) { cin >> p.first; return cin >> p.second; } long long lcm(int a, int b) { return (a / __gcd(a, b)) * b; } signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,a,b,c; cin >> n >> a >> b >> c; int _a = n/a; int _b = n/b; int _c = n/c; int _ac = n/(lcm(a,c)); int _ab = n/(lcm(a,b)); int _bc = n/(lcm(b,c)); int _abc = n/(lcm(lcm(a,b),c)); // cout << _a << " " << _b << " " << _c << " " << _ab << " " << _bc << " " << _ac << " " << _abc; cout << _a + _b + _c - _ab -_ac - _bc + _abc << "\n"; return 0; }