Search found 9 matches

by Codemonkey2000
Wed Oct 01, 2008 11:23 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 117408

Re: Wrong Answer for 102

Why do I keep getting WA?

#include <iostream>
#include <string>
using namespace std;

int main()
{
int B[3],G[3],C[3];
long BGC,BCG,CGB,CBG,GBC,GCB;
while(cin>>B[0]>>G[0]>>C[0]>>B[1]>>G[1]>>C[1]>>B[2]>>G[2]>>C[2])
{
BCG=G[0]+C[0]+ B[1]+G[1]+ B[2]+C[2];
BGC=G[0]+C[0]+ B[1]+C[1]+ B[2]+G[2 ...
by Codemonkey2000
Mon Jan 07, 2008 5:29 am
Forum: Volume 102 (10200-10299)
Topic: 10213 - How Many Pieces of Land ?
Replies: 54
Views: 31248

Is this the right formula f(n)=2*f(n-1) where f(1)=1?
by Codemonkey2000
Mon Dec 17, 2007 12:20 am
Forum: Volume 103 (10300-10399)
Topic: 10315 - Poker Hands
Replies: 63
Views: 38853

Hi, I'm wondering, is there a more efficient way of determining a hand. I was thinking about looking at the probability of getting a hand, and seeing if it matches the probability of getting say a flush.
by Codemonkey2000
Sat Dec 15, 2007 6:01 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319930

#include<iostream>

int foo(long num)
{
long c=num;
long iter=1;
while (c!=1)
{
if ((c%2)==0)
c/=2;
else
c=c*3+1;
iter++;
}
return iter;
}

int main()
{
long i,j,tmp,max;
while (std::cin>>i>>j)
{
std::cout<<i<<" "<<j<<" ";
if (i>j)
{
tmp=i;
i=j;
j=tmp;
}
max=0;
for (long x =i ...
by Codemonkey2000
Sat Dec 15, 2007 5:42 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319930

Re: If you get WA in problem 100, read me before post!

This problem is really tuff, even if it is the first one, anyway here is a source code, it got AC.

var
i, j: integer;

function getCL(N: integer): integer;
var k: integer;
begin
k := 1;
while N <> 1 do begin
if odd(N) then N := 3*N + 1
else N := N div 2;
k := k + 1;
end;
getCL := k;
end ...
by Codemonkey2000
Tue Dec 11, 2007 11:56 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319930

Leonid wrote:
Codemonkey2000 wrote:I'm not getting WA, I'm getting Tile limit exceeded.
Use more efficient implementation
I know, but how can I make my code any more efficient? I posted the code above.
by Codemonkey2000
Tue Dec 11, 2007 12:41 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319930

I'm not getting WA, I'm getting Tile limit exceeded.
by Codemonkey2000
Sun Dec 09, 2007 7:07 am
Forum: Bugs and suggestions
Topic: All the dates display my birthday.
Replies: 1
Views: 1930

All the dates display my birthday.

All the dates display my birth day. THis is just weird.
by Codemonkey2000
Sun Dec 09, 2007 6:56 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 319930

I keep getting time limit exceeded. I don't know how to make this code any more efficient. Am I missing something? :S
uses crt;
var i,j,max,x,tmp:longInt;

function foo(a:longInt):longInt;
var x,c:longInt;
begin
x:=a;
c:=1;
while (x<>1) do
begin
if ((x mod 2) =0) then
x:=x div 2
else
x:=x*3 ...

Go to advanced search