結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2023-04-23 10:15:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,201 bytes |
コンパイル時間 | 2,853 ms |
コンパイル使用メモリ | 243,712 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 18:14:23 |
合計ジャッジ時間 | 3,822 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef vector<int> VI;typedef vector<ll> VL;typedef vector<vector<int>> VII;typedef vector<vector<ll>> VLL;typedef vector<string> VS;#define pii pair<int,int>#define pll pair<ll,ll>#define pis pair<int,string>#define psi pair<string,int>#define rep(i,num,n) for(int i=num;i<(int)(n);i++) //for_loop#define rrep(i,num,n) for(int i=num-1;i>=(int)(n);i--) //reverse_for>#define in(x,a,b) (a<=x && x<b)//範囲#define reo return 0#define all(v) v.begin(),v.end()#define INF 2000000000#define INFL 9000000000000000000const long double pi = 3.1415926535897932384626433832795028841971L;const ll MOD=1000000007;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }int main(){ll N,A,B,C;cin>>N>>A>>B>>C;ll a,b,c;a=N/A,b=N/B,c=N/C;ll AB,BC,CA,ABC;ll ab,bc,ca,abc;AB=A*B/gcd(A,B),BC=B*C/gcd(B,C),CA=C*A/gcd(C,A);ab=N/AB,bc=N/BC,ca=N/CA;ABC=A*BC/gcd(A,BC);abc=N/ABC;ll ans=a+b+c-ab-bc-ca+abc;cout<<ans<<endl;}