Search found 8 matches
- Sat Aug 25, 2007 7:58 am
- Forum: Volume 100 (10000-10099)
- Topic: 10071 - Back to High School Physics
- Replies: 49
- Views: 15535
- Fri Aug 24, 2007 8:06 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10071 - Back to High School Physics
- Replies: 49
- Views: 15535
- Fri Aug 24, 2007 7:12 pm
- Forum: Volume 1 (100-199)
- Topic: 133 - The Dole Queue
- Replies: 42
- Views: 10705
- Fri Aug 24, 2007 7:09 pm
- Forum: Volume 1 (100-199)
- Topic: 133 - The Dole Queue
- Replies: 42
- Views: 10705
- Fri Aug 24, 2007 6:52 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10071 - Back to High School Physics
- Replies: 49
- Views: 15535
Im feeling stupid cause i cant find the answer. Help please?
Code: Select all
Code removal requested =)
- Fri Aug 24, 2007 6:45 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320329
made
and worked! thanks! =D
Your C program has solved Ok the problem 100 (The 3n + 1 problem) in 4.172 seconds using as much as 392 kbytes of virtual memory.
Congratulations!
Code: Select all
while(scanf("%d",&i) == 1 )
Your C program has solved Ok the problem 100 (The 3n + 1 problem) in 4.172 seconds using as much as 392 kbytes of virtual memory.
Congratulations!
- Fri Aug 24, 2007 5:55 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320329
- Fri Aug 24, 2007 2:46 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 320329
100 TL
I know its a easy problem but i cant get less than 10 secons of run time. Could somebody help me please?
#include <stdio.h>
int Cycles(long n)
{
long cycles;
cycles = 1;
if(n <= 0) return 0;
while(n!=1)
{
if(n%2 != 0)
n = (3*n)+1;
else
n /= 2;
cycles++;
}
return cycles;
}
int ...
#include <stdio.h>
int Cycles(long n)
{
long cycles;
cycles = 1;
if(n <= 0) return 0;
while(n!=1)
{
if(n%2 != 0)
n = (3*n)+1;
else
n /= 2;
cycles++;
}
return cycles;
}
int ...