結果
問題 |
No.316 もっと刺激的なFizzBuzzをください
|
ユーザー |
![]() |
提出日時 | 2025-02-06 21:50:45 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 10,068 ms |
コンパイル使用メモリ | 252,716 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-06 21:51:02 |
合計ジャッジ時間 | 11,998 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (b != 0) { long long temp = b; b = a % b; a = temp; } return a; } long long lcm(long long x, long long y) { return (x / gcd(x, y)) * y; } int main() { long long int n = 0; cin >> n; int a = 0, b = 0, c = 0; cin >> a >> b >> c; int countA = n / a; int countB = n / b; int countC = n / c; int countAB = n/lcm(a,b); int countBC = n/lcm(b,c); int countAC =n/lcm(a,c) ; int countABc = n/lcm(a,lcm(b,c)); cout << countA + countB + countC - countAB - countBC - countAC + countABc << endl; }