Đăng nhập để hỏi chi tiết
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 ll long long
bool check(long long x){
for(long long i=2;i<=sqrt(x);i++)
if(x%i==0) return false;
return x>1;
}
ll nttd(ll n,ll m){
for(ll i=1;i<=max(n,m);i++){
if(check(i)){
if((n%i==0 and m%i!=0)or(m%i==0 and n%i!=0))
return 0;
}
}
return 1;
}
using namespace std;
int main(){
long long N,M;
cin>>N>>M;
if(nttd(N,M))
cout<<"YES";
else cout<<"NO";
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin