Problem link : UVa 10110 - Light more light
Solution :
#include<stdio.h>
#include<math.h>
int main()
{
long long int n,a,i;
while(scanf("%lld",&n)==1)
{
if(n==0)
break;
i=sqrt(n);
a=i*i;
if(a==n)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
Solution :
#include<stdio.h>
#include<math.h>
int main()
{
long long int n,a,i;
while(scanf("%lld",&n)==1)
{
if(n==0)
break;
i=sqrt(n);
a=i*i;
if(a==n)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
No comments:
Post a Comment