Search found 3 matches

Mon Apr 07, 2003 2:24 pm
Forum: Volume 3 (300-399)
Topic: 371 - Ackermann Functions
Replies: 196
Views: 28807
some one please help me too its givin wa.... :cry: i didnt understand how to replace 3*n +1 to (3*n)/2+1 will it not affect the cycle length..... [cpp]#include<iostream.h> #include<math.h> int cycle(double n) { int len = 0; while(n!=1) { n = (fmod (n,2))? (3*n+1):n/2; len ++; } return len; } void ma...
Mon Mar 17, 2003 2:22 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 50128

can any one tell me whats wrong

[c]#include<stdio.h> int main() { unsigned long int b[3][3],min,j; int no ; while(scanf("%ld %ld %ld %ld %ld %ld %ld %ld %ld",&b[0][0],&b[0][1],&b[0][2],&b[1][0],&b[1][1],&b[1][2],&b[2][0],&b[2][1],&b[2][2]) == 9) { j = min = no = 0; //for bcg j = b[1][0]+b[2][0] + b[0][2]+b[2][2] + b[0][1]+b[1][1];...
Sun Mar 09, 2003 10:51 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 184485

100 i am a newbie..plz tell me whts wrong with this code(WA)

[c]#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char *ch1,*temp,*ch2,*ch3 = " "; unsigned long a,b,j,k,l,m; char s[50]; int i = 0; int no,maxi = 0; short p; while( (*temp = getchar()) != EOF ) { if (*temp == '\n') { ch1 = s; ch2 = strstr(ch1,ch3); b = atol(ch2); a = atol(ch1)...