I write it in C.
Can anyone help me with this?
WA
#include<stdio.h>
#include<stdlib.h>
int howlong(int q)
{ int a;
a=0;
qwe:
if(q==1)
{goto asd;
}
else if(q%2==1)
{q=3*q+1;
}
else
{q=q/2;
}
a++;
goto qwe;
asd:
a++;
return a;
}
main()
{
int a,b,c,i,j;
scanf("%d %d",&i ...
Search found 2 matches
- Sat Jul 02, 2011 5:12 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319953
- Thu Jun 30, 2011 6:57 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 319953
Re: If you get WA in problem 100, read me before post!
I write it in C.
Can anyone help me with this?
WA
#include<stdio.h>
#include<stdlib.h>
int howlong(int q)
{ int a;
a=0;
qwe:
if(q==1)
{goto asd;
}
else if(q%2==1)
{q=3*q+1;
}
else
{q=q/2;
}
a++;
goto qwe;
asd:
a++;
return a;
}
main()
{
int a,b,c,i,j;
scanf("%d %d",&i ...
Can anyone help me with this?
WA
#include<stdio.h>
#include<stdlib.h>
int howlong(int q)
{ int a;
a=0;
qwe:
if(q==1)
{goto asd;
}
else if(q%2==1)
{q=3*q+1;
}
else
{q=q/2;
}
a++;
goto qwe;
asd:
a++;
return a;
}
main()
{
int a,b,c,i,j;
scanf("%d %d",&i ...