結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2018-10-28 18:00:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 643 bytes |
コンパイル時間 | 633 ms |
コンパイル使用メモリ | 82,232 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-19 07:12:04 |
合計ジャッジ時間 | 1,566 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cstdio> #include <cstring> #include <string> #include <math.h> using namespace std; typedef long long ll; typedef double D; typedef pair<int,int> P; #define M 1000000007 #define F first #define S second #define PB push_back #define INF 100000000000000000 ll n,a,b,c; ll gcd(ll x,ll y){ if(x<y)swap(x,y); if(x%y==0)return y; return gcd(y,x%y); } ll lca(ll x,ll y){ return x*y/gcd(x,y); } int main(void){ cin>>n>>a>>b>>c; cout<<n/a+n/b+n/c-n/lca(a,b)-n/lca(b,c)-n/lca(c,a)+n/lca(lca(a,b),c)<<endl; }