'commit'
This commit is contained in:
30
C++课程/第十六课循环结构程序设计实例2/p177_2.cpp
Normal file
30
C++课程/第十六课循环结构程序设计实例2/p177_2.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
int main(void) {
|
||||
long long a, b,i;
|
||||
|
||||
scanf("%lld%lld", &a, &b);
|
||||
int success=1;
|
||||
|
||||
while(b%2==0) {
|
||||
if(a%2!=0) {
|
||||
success=0;
|
||||
}
|
||||
b/=2;
|
||||
}
|
||||
for(i=3; i<=sqrt(b); i+=2) {
|
||||
if(b%i==0) {
|
||||
if(a%i!=0) {
|
||||
success=0;
|
||||
}
|
||||
b/=i;
|
||||
i-=2;
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
printf("Yes\n");
|
||||
else
|
||||
printf("No\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user