結果
| 問題 |
No.316 もっと刺激的なFizzBuzzをください
|
| コンテスト | |
| ユーザー |
sntea
|
| 提出日時 | 2015-12-09 00:15:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 950 bytes |
| コンパイル時間 | 1,289 ms |
| コンパイル使用メモリ | 159,544 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 11:21:35 |
| 合計ジャッジ時間 | 2,496 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
#include <cmath>
#include <climits>
#include <cstdio>
using namespace std;
#define endl '\n'
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define AALL(a,n) (a),(a)+(n)
typedef pair<int,int> P;
typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<LL,LL> LP;
long long gcd(long long x, long long y){
return y==0 ? x : gcd(y, x%y);
}
long long lcm(long long x, long long y){
return x/gcd(x,y)*y;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int N;
int a[3];
cin >> N;
REP(i,3) cin >> a[i];
int ans = N/lcm(a[0],lcm(a[2],a[1]));
REP(i,3){
ans += N/a[i];
ans -= N/lcm(a[(i+1)%3],a[(i+2)%3]);
}
cout << ans << endl;
return 0;
}
sntea