結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2016-03-13 13:39:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 504 ms |
コンパイル使用メモリ | 59,384 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 12:18:20 |
合計ジャッジ時間 | 1,414 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (i = e-1; i >= s; i--)#define rrep(i,n) RREP(i,0,n)#define REP(i,s,e) for (i = s; i < e; i++)#define rep(i,n) REP(i,0,n)#define INF 1e8typedef long long ll;int gcd(int a, int b) {return (b == 0) ? a : gcd(b,a%b);}ll lcd(ll a, ll b) {return a * b / gcd(a,b);}int main() {int n, a, b, c, ans;cin >> n >> a >> b >> c;ans = 0;ans += n / a + n / b + n / c;ans -= n / lcd(a,b) + n / lcd(b,c) + n / lcd(c,a);ans += n / lcd(lcd(a,b),c);cout << ans << endl;return 0;}