結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2020-01-29 18:52:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 164,944 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 01:55:23 |
合計ジャッジ時間 | 2,812 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;using lint=long long;template<class T> T gcd(const T& a,const T& b){ return b==0?a:gcd(b,a%b); }template<class T> T lcm(const T& a,const T& b){ return a/gcd(a,b)*b; }int main(){lint n,a,b,c; scanf("%lld%lld%lld%lld",&n,&a,&b,&c);printf("%lld\n",n/a+n/b+n/c-n/lcm(a,b)-n/lcm(b,c)-n/lcm(c,a)+n/lcm(lcm(a,b),c));return 0;}