結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2025-02-05 02:20:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 981 bytes |
コンパイル時間 | 3,658 ms |
コンパイル使用メモリ | 272,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-02-05 02:20:56 |
合計ジャッジ時間 | 5,260 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define vi vector<int> #define vs vector<string> #define int long long int #define pii pair<int,int> #define pb push_back #define f(i,a,b) for(int i=a;i<b;i++) #define ff first #define s second #define nl cout<<endl; #define print(a) cout<<a<<"\n"; #define all(a) (a).begin(), (a).end() #define parr(a) f(mnb,0,a.size()){cout<<a[mnb]<<" ";}cout<<endl; #define rarr(a) f(yon,0,a.size()){cin>>a[yon];} #define imx INT_MAX #define imn INT_MIN #define sortD(a) sort(a.end(),a.begin()); #define sortA(a) sort(all(a)); void solve(){ int n; cin >> n; int a, b, c; cin >> a >>b >> c; int ans = n/a + n/b + n/c; int lcmab = (a*b)/__gcd(a,b); int lcmac = (a*c)/__gcd(a,c); int lcmbc = (c*b)/__gcd(c,b); ans -= n/(lcmab); ans -= n/(lcmac); ans -= n/(lcmbc); int lcm = (c*lcmab)/__gcd(c,lcmab); cout<< ans + n/lcm ; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; //cin>>t; while(t--){ solve(); } }