Search found 46 matches

by Fresh
Wed Nov 20, 2002 6:03 am
Forum: Volume 4 (400-499)
Topic: 484 - The Department of Redundancy Department
Replies: 103
Views: 9241

...

Change 'char' to 'int' and split the input as below, [cpp] while(gets(y)) { int inp; char *p = strtok(y); while (p != NULL) { inp = atoi(p); p = strtok(NULL," \n"); ..... ..... } ..... ..... } [/cpp] -novice :wink:
by Fresh
Wed Nov 20, 2002 5:44 am
Forum: C++
Topic: Grow Array Size
Replies: 13
Views: 4658

Grow Array Size

Hi, Is there any solution to grow an dynamic array without free and reallocate it, then recopy the original value? I did some experiment as below, only works for 'int'(how good/reliable is it?) and nop the 'char'. Help! [cpp] void main() { int i, *pnum, *num; char *pstr, *str; // Grow 'int' type arr...
by Fresh
Mon Nov 18, 2002 4:53 am
Forum: Volume 4 (400-499)
Topic: 484 - The Department of Redundancy Department
Replies: 103
Views: 9241

...

The buffer size nop big enough?

-novice :-?
by Fresh
Mon Nov 11, 2002 11:10 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 43552

...

If i know your mail address... i can send mine exec

-novice :-?
by Fresh
Wed Nov 06, 2002 5:26 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 29148

...

Try this - Store the sample input in a file, let's say input.txt. Make executable file (p105.exe) and at command prompt, test the output by typing 'c:\p105 < input.txt'. You can print the output to a file with 'c:\p105 < input.txt >output.txt'

-novice :wink:
by Fresh
Sun Nov 03, 2002 5:08 pm
Forum: C
Topic: malloc
Replies: 17
Views: 8519

malloc

For char string,

[cpp]

char **TmpName = (char**)malloc(10);

for (int i=0; i<10; i++)
TmpName = (char*)malloc(80);
//endfor

[/cpp]


-novice :D
by Fresh
Tue Aug 27, 2002 9:51 am
Forum: Other words
Topic: Free book of Algorithms
Replies: 6
Views: 2834

Thanks

Thanks++ from a novice, a very useful information!

-novice :D
by Fresh
Fri Aug 23, 2002 5:18 pm
Forum: Volume 6 (600-699)
Topic: 621 - Secret Research
Replies: 45
Views: 19367

Help

Hi,

U're right for the '+' sign but nop the others. Read the question carefully.

[cpp]
'-' for a[strlen(a) - 2] = "35"
'*' for a[0] = '9' and a[strlen(a) - 1] = '4'
'?' for a[0-2] = "190"
[/cpp]

-novice :roll:
by Fresh
Mon Aug 19, 2002 6:21 pm
Forum: General
Topic: Solutions for the problems
Replies: 8
Views: 3060

Finally...

I forgot, the mail address :lol:. Now my speed is 0:00.050(64), just remove strtok() and follow your second instruction. It satisfied me even it's far slower than yours. But then, i mailed u my code... u might comment something about it espesially in converting a string to number.

-novice :wink:
by Fresh
Fri Aug 16, 2002 6:17 pm
Forum: General
Topic: Solutions for the problems
Replies: 8
Views: 3060

Still Using 'strtok()'

Ivor,

I'm tired. The best result i could do is 0:00.060(64) and it still using strtok! I really not understand... doesn't the strtok itself uses a pointer ('char *p')? If u're willing to help me, may i know your mail address? I'll mail u my code.

-novice :-?
by Fresh
Wed Aug 14, 2002 6:52 pm
Forum: General
Topic: Solutions for the problems
Replies: 8
Views: 3060

fread/fwrite

Additional to what dawynn said, ...optimized IO by reading/writing large blocks of data in raw format and parsing/printing it on their own... ...if you want fast I/O then forget about cin/scanf. Use at least gets(), it works much faster. And parse input by your own (again, without something like str...
by Fresh
Wed Jul 31, 2002 3:24 pm
Forum: Volume 4 (400-499)
Topic: 450 - Little Black Book
Replies: 57
Views: 6680

...

I think the problem is the way u handle/split the input. Try use dynamic memory and strtok. [cpp] // your structure typedef struct list { char *title, *firstn, *lastn, *addr; char *depart, *home, *work, *box; }data; i = 0; while(gets(s)!=NULL) { if (!strlen(s)==0) break; in ->depart = (char*)malloc(...
by Fresh
Wed Jul 31, 2002 2:50 pm
Forum: Other words
Topic: 10342 and 10342 is fixed now
Replies: 10
Views: 3767

...

But i used 'unsigned char' variable type and fwrite for the output. Should be ok and i 100% sure my Base64 class has no problem!

-novice :-?
by Fresh
Wed Jul 31, 2002 9:22 am
Forum: Other words
Topic: 10342 and 10342 is fixed now
Replies: 10
Views: 3767

...

How about problem 10343 - Base64 Decoding? Nobody got accepted during real contest.

-novice :cry:

Go to advanced search