Search found 46 matches

by Fresh
Thu Jul 11, 2002 9:12 am
Forum: Volume 6 (600-699)
Topic: 694 - The Collatz Sequence
Replies: 46
Views: 16333

Overflow

Try use 'long long' declaration, ((10^9) * 3 + 1) > MAX_INT

-novice
by Fresh
Thu Jul 11, 2002 9:00 am
Forum: C
Topic: Scan of input file ....
Replies: 14
Views: 11624

Thanks

Thanks, finally i got it.
by Fresh
Thu May 23, 2002 5:13 am
Forum: C++
Topic: Name input
Replies: 2
Views: 2339

cin.getline()

If you use 'cin' before 'cin.getline', add cin.ignore(10,'\n'); right after the cin. Your fixed module: [cpp] void getinfo() { cout <<"Roll no:"; cin >> roll; cin.ignore(10, '\n'); cout <<"Name:"; cin.getline(line,50); cout <<"Age:"; cin >> age; cout <<"Sex:"; cin >> sex; cout <<"Height:"; cin >> he...
by Fresh
Wed May 22, 2002 7:34 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 26281

Help

If you still fail on this problem try visit link below or mail me your code.

http://www.comp.nus.edu.sg/~stevenha/pr ... /vol1.html

-novice :wink:
by Fresh
Wed May 22, 2002 7:24 pm
Forum: Volume 3 (300-399)
Topic: 374 - Big Mod
Replies: 79
Views: 12568

What's the problem? PE, TLE, WA? Dont just send the code.

-novice :-?
by Fresh
Wed May 22, 2002 11:23 am
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 22135

so many source code posted

Did you read the problem carefully? Dont just post the code and ask why, why, why and why...
.. wrote:In these days, the board is full of source code....
Why do the people just hope others to debug for them? :evil:
-novice :-?
by Fresh
Wed May 22, 2002 5:29 am
Forum: Volume 3 (300-399)
Topic: 330 - Inventory Maintenance
Replies: 26
Views: 7584

P330

My accepted program said as below, seem similar to yours. [c] INVENTORY REPORT Item Name Buy At Sell At On Hand Value --------- ------ ------- ------- ----- ------------------------ Total value of inventory 0.00 Profit since last report 5.00 [/c] -novice :roll:
by Fresh
Tue May 21, 2002 6:18 am
Forum: Volume 2 (200-299)
Topic: 271 - Simply Syntax
Replies: 46
Views: 12832

EOF

I normally use this style,

[cpp]
int len;
char s[1024];

while (cin.getline(s,1024))
{ if (!(len = strlen(s))) break;
process(s,len);
}
[/cpp]

-novice :wink:
by Fresh
Tue May 21, 2002 6:09 am
Forum: C
Topic: Scan of input file ....
Replies: 14
Views: 11624

scanf/printf

Hi, Just for my additional knowledge. Could someone tell me the format string for every declaration below; [c] unsigned char s[100] scanf("%us",s); //is it correct? short x; unsigned short x; long long x; long long int x; long int x; long double x; unsigned long x; unsigned int x; unsigned double x;...
by Fresh
Sat May 18, 2002 9:55 am
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 53523

ASM

you seem have used asm Is this mean that the Online Judge support ASM beside C/C++, Jave and Pascal? If yes, how to submit the solution or any trick to do this? But that's a trade secret If you're really interested and have a good imagination you'll soon find out. All you have to do is learn it you...
by Fresh
Sat May 18, 2002 9:35 am
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 53523

printf

Try this, it may help:

[cpp]
#include <stdio.h>
....
....
printf("%s%1.0f\n",c,min);
[/cpp]

-novice :wink:
by Fresh
Thu May 16, 2002 8:26 am
Forum: Volume 3 (300-399)
Topic: 366 - Cutting Up
Replies: 7
Views: 3599

URL

It's still not working...

-novice :(
by Fresh
Wed May 15, 2002 4:48 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 53523

iostream vs stdio?

I don't know how some people solved this problem just in 0.010s. But honestly to say, your time still fast since mine is 0.380s. From my experince, 'cin' is much faster than 'scanf' but 'cout' is slower than 'printf' so use 'cin' for input and 'printf' for output. For those who solved this problem i...
by Fresh
Fri May 10, 2002 12:23 pm
Forum: C++
Topic: Deallocate Memory
Replies: 6
Views: 3139

Static vs Dynamic

Yeah, delete can waste time but some of the problems require large amount of memory. Dynamic allocation can prevent from Runtime Error (SIGSEGV) for example problem 450 (Little Black Book). Time doesn't a matter here. BTW, thanks for your answer.

-novice :wink:
by Fresh
Fri May 10, 2002 10:28 am
Forum: C++
Topic: Deallocate Memory
Replies: 6
Views: 3139

Deallocate Memory

Hi, I allocated memory spaces for 's' as below: [cpp] char *s[10]; for (int i=0; i<10; i++) s = (char*)malloc(100); //endif [/cpp] But how to deallocate the 's'? Am I just need free(s) or do it one by one of the elements as below? [cpp] for (int i=0; i<10; i++) free(s ); //endif [/cpp] -novice :-?

Go to advanced search