Search found 2 matches

by thesnikes
Sun Dec 14, 2003 5:57 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320456

ah. ok

I did read the sticky but I didn't realize that they meant a might be less than b and that I should handle that case ;)

thanks.
by thesnikes
Sun Dec 14, 2003 8:25 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320456

WA in 100!?

hi all, any help would be appreciated! I have tried long long, memoization, etc... i give up ;)

*never mind*... read the sticky.
/* @BEGIN_OF_SOURCE_CODE */
#include <iostream>
using namespace std;

long docycle (long x)
{
long i=1;

while (x!=1)
{
if (x%2==0)
x=x/2;
else
{
i++;
x=(x*3)+1 ...

Go to advanced search