Please anyone help me.I getting WA.But my output has no problem.
#include<stdio.h>
long int task(long long int m)
{ int c=1;
do
{
if(m%2==1)
m=(3*m)+1;
else
m=m/2;
c++;
}while(m!=1);
c++;
return c;
}
int main()
{
long long int x,y,i,j,m,n,b,max=0;
long int task(long long int m ...
Search found 3 matches
- Mon Jan 24, 2011 9:23 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 317994
- Sun Dec 20, 2009 9:23 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10110 - Light, more light
- Replies: 76
- Views: 39769
Re: 10110-Light more Light-in C
I found my mistake and gotAC.



- Tue Dec 08, 2009 3:27 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10110 - Light, more light
- Replies: 76
- Views: 39769
10110-Light more Light-in C
When i submit this problem i getting TLE.Please help me!!
#include<stdio.h>
#include<math.h>
int main()
{
int t;
unsigned long int input;
double sq;
scanf("%d",&t);
while(t--)
{
scanf("%lu",&input);
sq=sqrt(input);
if(sq*sq==input)
printf("NO");
else
printf("YES");
}
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
int t;
unsigned long int input;
double sq;
scanf("%d",&t);
while(t--)
{
scanf("%lu",&input);
sq=sqrt(input);
if(sq*sq==input)
printf("NO");
else
printf("YES");
}
return 0;
}