MPGH Logistic Programming Challenge

Posts 1630 of 33 · Page 2 of 3
Quote Originally Posted by Hell_Demon View Post
The only thing I have read from this is:


and



so /care if it fails
It's [F(subscript: n-1) + F(subscript: n-2)] opposed to F(subscript: n) - 1 etc /.

I got the Fibonacci working in VB , I know noone cares but it IS just logic so programming language doesn't matter
Quote Originally Posted by Void View Post
Can't believe you're going through with this Justin. |:

By the way, me and User1 have bragging rights over you until you finish the triangle.
I FINISHED IT. FUCK YOU
Even pascal's triangle isn't that hard as well.

Code:
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int n;
    int i;
    int j;

    printf("How big is your triangle?: ");
    
    scanf("%d", &n);
    
    for (i=0; i<n; i++) {
        int c = 1;
        for(j=i; j>=0; j--) {
            printf(" %d", c);
            c = c * j/(i-j+1);
        }
        printf("\n");
    }
}
I ARE PASS

[php]#include <iostream>
using namespace std;

int fibonacci(int nth);

int main()
{
int nth, result;
cout << "Place in sequece?\n";
cin >> nth;
result = fibonacci(nth);
cout << result;


}

int fibonacci(int nth)
{
if(nth < 3)
{
return 1;
}
else
{
return fibonacci(nth-2) + fibonacci(nth-1);
}
}

[/php]
Quote Originally Posted by rtemis View Post
I ARE PASS
you are fail
it doesn't work right
Quote Originally Posted by Toxic Waltz View Post
you are fail
it doesn't work right
It works till 38 for me so it works




Quote Originally Posted by rtemis View Post


It works till 35 so it works
oops didn't read it correctly...
im not gonna test the code. too lazy
Quote Originally Posted by scimmyboy View Post
im not gonna test the code. too lazy
thats why i gave a ss
You guys' Code will fail on a certain point if you use 32 Bits Integers.

Use __Int64, They can hold wayyy more data, And your thingy can go waaay Further =).



Int Max/Min 2147483647 / -2147483648

__Int64 Max/Min 9223372036854775807 / -9223372036854775808
Quote Originally Posted by Melodia View Post
You guys' Code will fail on a certain point if you use 32 Bits Integers.

Use _Int64, They can hold wayyy more data, And your thingy can go waaay Further =).



Int Max/Min 2147483647 / -2147483648

__Int64 Max/Min 9223372036854775807 / -9223372036854775808
so id declare like

[php]_int64 number;[/php]?
Quote Originally Posted by rtemis View Post


so id declare like

[php]_int64 number;[/php]?
Try it .
Quote Originally Posted by Melodia View Post
You guys' Code will fail on a certain point if you use 32 Bits Integers.

Use __Int64, They can hold wayyy more data, And your thingy can go waaay Further =).



Int Max/Min 2147483647 / -2147483648

__Int64 Max/Min 9223372036854775807 / -9223372036854775808
oo its __int64 (two underlines)
Quote Originally Posted by Melodia View Post
Try it .
I tried it and it works.

But my program still hangs if a number in the sequence entered is larrger than 38

[php]#include <iostream>
using namespace std;

_int64 fibonacci(_int64 nth);

int main()
{
_int64 nth, result;
cout << "Place in sequece?\n";
cin >> nth;
result = fibonacci(nth);
cout << result;


}

_int64 fibonacci(_int64 nth)
{
if(nth < 3)
{
return 1;
}
else
{
return fibonacci(nth-2) + fibonacci(nth-1);
}
}

[/php]
Quote Originally Posted by rtemis View Post


I tried it and it works.

But my code still hangs if a number in the sequence entered is larrger than 38

[php]#include <iostream>
using namespace std;

_int64 fibonacci(_int64 nth);

int main()
{
_int64 nth, result;
cout << "Place in sequece?\n";
cin >> nth;
result = fibonacci(nth);
cout << result;


}

_int64 fibonacci(_int64 nth)
{
if(nth < 3)
{
return 1;
}
else
{
return fibonacci(nth-2) + fibonacci(nth-1);
}
}

[/php]
You compile your project in x64 At least ?
Posts 1630 of 33 · Page 2 of 3

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?