Search found 2 matches

by Rale
Sun Jul 16, 2006 1:35 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320256

I got a WA again.

It ran for a little bit more than 5 seconds, and the answer is WRONG!

My code is two posts up, what's wrong with it????

I only changed that to cycle(0).
by Rale
Sat Jul 15, 2006 6:59 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320256

I don't understand how long do I read input.

I apologise if the question has already been asked, but I simply don't understand it. Here is my code, if it helps:

#include <stdio.h>

int cycle (int n) {
int i=0;
while (n>0) {
i++;
if (n==1) break;
if (n%2 == 1) n=3*n +1;
else n=n/2;
}
return ...

Go to advanced search