题解:AT_joi2025_yo1c_c いずれか片方 (Either, but Not Both)
直接暴力遍历
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
int cnt = 0;
for(int i = 1; i <= n; i++) {
if(i % a == 0 && i % b) cnt++;
if(i % b == 0 && i % a) cnt++;
}
cout << cnt;
return 0;
}