

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include<bits/stdc++.h>
#define int long long
using namespace std;
int b, n, res;
signed main () {
freopen("fraction.inp", "r", stdin);
freopen("fraction.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> b >> n;
for(int m = 1; m <= n * 2; m ++) {
if((b * m * (2 * n - m)) % (n * n) == 0) {
if(m != n && (b * m * (2 * n - m)) / (n * n) != b) res ++;
}
}
cout << res;
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
![]()
#include<bits/stdc++.h>
using namespace std;
long long b,n,r;
int main() {
cin>>b>>n;
for (int i=1;i<=2*n;i++) {
if ((b*i*(2*n-i))%(n*n)==0 && i!=n && (b*i*(2*n-i))/(n*n)!=b)
r++;
}
cout<<r;
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin