結果
問題 |
No.3152 neither multiple of A nor B
|
ユーザー |
|
提出日時 | 2025-08-21 01:25:05 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 2,938 ms |
コンパイル使用メモリ | 275,828 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-21 01:25:10 |
合計ジャッジ時間 | 4,924 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define ALL(a) (a).begin(), (a).end() #define endl '\n' int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long N, A, B; cin >> N >> A >> B; if (A == 1 || B == 1) { cout << 0 << endl; return 0; } long tmp = lcm(A, B); long mul = N / A + N / B - N / tmp; long ans = N - mul; cout << ans << endl; return 0; }