杭电ACM 2040哪里错了?
#include<stdio.h>intmain(){intm,i,j,a,b,k,sum1,sum2;while(scanf("%d",&m)!=EOF){k=j=2;...
# include <stdio.h>
int main()
{
int m,i,j,a,b,k,sum1,sum2;
while(scanf("%d",&m)!=EOF)
{
k=j=2;
sum1=sum2=0;
for(i=0;i<m;i++)
{ scanf("%d%d", &a, &b);
while(a>1)
if(a%j==0)
{
sum1+=j;
a/=j;
}
while(b>1)
if(b%k==0)
{
sum2+=k;
b/=k;
}
if(b==sum1 && a==sum2)
printf("YES\n");
else
printf("NO\n");
}
}
return 0;
} 展开
int main()
{
int m,i,j,a,b,k,sum1,sum2;
while(scanf("%d",&m)!=EOF)
{
k=j=2;
sum1=sum2=0;
for(i=0;i<m;i++)
{ scanf("%d%d", &a, &b);
while(a>1)
if(a%j==0)
{
sum1+=j;
a/=j;
}
while(b>1)
if(b%k==0)
{
sum2+=k;
b/=k;
}
if(b==sum1 && a==sum2)
printf("YES\n");
else
printf("NO\n");
}
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询