Search found 11 matches

by newhh2002
Sat Feb 01, 2003 7:30 am
Forum: Volume 102 (10200-10299)
Topic: 10201 - Adventures in Moving - Part IV
Replies: 23
Views: 14894

I think Even is right for the following inputs


10
500
100 1
300 1
350 1
501 10

101
100 100
102 1

100

101

200
100 10

201
100 10

201
101 10

50
25 10

150
100 10
151 20

150
100 10
151 20
152 1




I get the results

970

301

Impossible

Impossible

2000 ...
by newhh2002
Wed Jan 29, 2003 1:14 pm
Forum: Volume 102 (10200-10299)
Topic: 10202 - Pairsumonious Numbers
Replies: 10
Views: 6692

10202 - Pairsumonious Numbers

i've checked my program, but wa, why?
would you help me? thanks!
[c]
//pairsumonious numbers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>

int result[9];
int data[37];
int count;
unsigned char used[37];

int SortFunction(const void *a,const void *b)
{
return *(int ...
by newhh2002
Tue Jan 28, 2003 1:06 pm
Forum: C
Topic: Serious problems!
Replies: 3
Views: 3475

hi, you can try
@begin_of_source_code
at the top and
@end_of_source_code
in the bottom
by newhh2002
Tue Jan 28, 2003 12:29 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

finally i know! it's multiple input :`(
but why still WA?
[c]
//3n+1
#include <stdio.h>
#include <string.h>

#define MAXNUM 60000

int table[MAXNUM];

int GetCount(long long n)
{
long long nn;
int result;
if (n<=MAXNUM && table[n-1]!=0)
return table[n-1];
if (n&1)
nn=n*3+1;
else
nn=n>>1 ...
by newhh2002
Tue Jan 28, 2003 10:57 am
Forum: Volume 101 (10100-10199)
Topic: 10164 - Number Game
Replies: 32
Views: 15929

10164

would you help me about the algorithm of #10164? it might be a easy problem, but i don't know how to solve it. (my method use much memory and results in "tle" :( i wonder how those guys on the ranklist did it) thanks!!!!!!!
by newhh2002
Tue Jan 28, 2003 8:33 am
Forum: Volume 5 (500-599)
Topic: 562 - Dividing coins
Replies: 73
Views: 44186

562

could someone tell me how did those guys solved the problem in 0.0000 seconds? what algorithm did they use? thank you
by newhh2002
Mon Jan 27, 2003 5:25 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

[c]
//3n+1
#include <stdio.h>

#define MAXNUM 30000

int table[MAXNUM]; //for "cache" use, no need too big

int GetCount(long long n)
{
long long nn;
int result;
if (n<=MAXNUM && table[n-1]!=0) //result is found in "cache"
return table[n-1];
if (n&1)
nn=n*3+1;
else
nn=n>>1;
result=1 ...
by newhh2002
Mon Jan 27, 2003 5:20 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

programming guidelines:

no function longer than ten lines
clean identation

try it out!

in case your program was properly indented, use the C function of this board to post it so people can read it!

example:

[c]int main(int argc, char **argv)
{
init();
solve();
clean();
return EXIT_SUCCESS ...
by newhh2002
Mon Jan 27, 2003 5:14 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

just a note: start doesn't have to be bigger than end.

and please do a search on the forum before asking.. there are a few ways to optimize this problem..

i tried but still tle :(
i tried on my pentium 133, speed is not the problem because i used "constants" and "cache", but i can't pass the ...
by newhh2002
Mon Jan 27, 2003 12:28 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

HELP 100 :..( wa/tle

could someone help me with #100? i've almost give up. i tested with many special cases but finally it does not pass :(

the following program results in "time limit exceed"(as you can see, i even added some "constants" in the program, so the speed should be fast). if i remove "table[maxnum]" and the ...
by newhh2002
Sun Jan 26, 2003 4:27 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 317862

#100 why compile error or time limit? :(

i use LCC-win32, the program can run, but why i get ce now? thanks

//3n+1

#include <stdio.h>

#define MAXNUM 60000 //cache

int table[MAXNUM];

int GetCount(unsigned long int n)
{
unsigned long int nn;
int result;
if (n<=MAXNUM && table[n-1]!=0)
return table[n-1];
if (n&1)
nn=n*3+1;
else ...

Go to advanced search