結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2016-11-24 01:33:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 573 bytes |
コンパイル時間 | 657 ms |
コンパイル使用メモリ | 80,460 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 10:29:07 |
合計ジャッジ時間 | 1,513 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; long gcd(long a,long b){return b?gcd(b,a%b):a;} long lcm(long a,long b){return a*b/gcd(a,b);} int main() { long long int n,a,b,c; cin>>n; cin>>a>>b>>c; int y=0; y+=n/a+n/b+n/c; y-=n/lcm(a,b)+n/lcm(a,c)+n/lcm(b,c)-n/lcm(lcm(a,b),c); cout<<y<<endl; return 0; }