#include <stdio.h>
unsigned long int problem(unsigned long int n)
{
if(n==1)
{
return 1;
}
else
{
if(n%2!=0)
{
return 1 + problem(3*n + 1);
}
else
{
return 1 + problem(n/2);
}
}
}
int main()
{
unsigned long int start,end,i,j,result,max_cycle;
while(scanf("%d %d",&i,&j) == 2 ...
Search found 3 matches
- Sat May 16, 2009 10:31 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318272
- Sat Jun 03, 2006 3:26 am
- Forum: Volume 100 (10000-10099)
- Topic: 10038 - Jolly Jumpers
- Replies: 445
- Views: 152803
10038 wrong answer
hi this is my program.It's saying WA.Can somebody look at my code.
/*@BEGIN_OF_SOURCE_CODE*/
#include <stdio.h>
#include<stdlib.h>
void q_sort(int *b, int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = b[left];
while (left < right)
{
while ((b ...
/*@BEGIN_OF_SOURCE_CODE*/
#include <stdio.h>
#include<stdlib.h>
void q_sort(int *b, int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = b[left];
while (left < right)
{
while ((b ...
- Fri Jun 02, 2006 11:05 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10038 - Jolly Jumpers
- Replies: 445
- Views: 152803
10038
hi this is my program.It's saying WA.Can somebody look at my code.
/*@BEGIN_OF_SOURCE_CODE*/
#include <stdio.h>
#include<stdlib.h>
void q_sort(int *b, int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = b[left];
while (left < right)
{
while ((b[right ...
/*@BEGIN_OF_SOURCE_CODE*/
#include <stdio.h>
#include<stdlib.h>
void q_sort(int *b, int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = b[left];
while (left < right)
{
while ((b[right ...