Search found 14 matches

by Jordan Gordeev
Fri Apr 16, 2004 9:08 pm
Forum: C++
Topic: How do u check for eoln in C++?
Replies: 3
Views: 2572

You can read character by character until reading an end-of-line character. This code in Pascal: [pascal]var f:Text; c:Char; while not eoln(f) do begin Read(f, c); {do something with c} end; Readln(f);{advance to the next line} [/pascal] might become [cpp]ifstream inp; char c; while ((c = inp.get())...
by Jordan Gordeev
Mon Feb 10, 2003 6:18 pm
Forum: Volume 2 (200-299)
Topic: 273 - Jack Straws
Replies: 19
Views: 3207

Incorrect problem description (probem 273)

I think that the description of problem 273 is wrong. It states that 1 < n < 13, but when I sent my solution, I received Runtime Error. When I enlarged my arrays to hold more than 12 sticks, I got Wrong Answer. Then I submitted a solution that would go into an endless loop if n is not between 1 and ...
by Jordan Gordeev
Sun Feb 02, 2003 8:18 pm
Forum: Pascal
Topic: 64 bit integer in pascal
Replies: 2
Views: 3738

The Judge's Pascal compiler (Free Pascal) has 64-bit signed integer type called Int64
by Jordan Gordeev
Thu Jan 23, 2003 8:45 pm
Forum: Algorithms
Topic: Miller-Rabin test
Replies: 2
Views: 2635

Miguel, I haven't read the code, but I know that int and long are both 32-bit signed integers for the Judge's C/C++ compiler.
by Jordan Gordeev
Tue Jan 14, 2003 9:02 pm
Forum: Algorithms
Topic: How to detect an arithmetic overflow
Replies: 6
Views: 3647

The right way to write detect_addition_overflow() is the following (see Leendert Ammeraal, Algorithms and Data Structures in C++, John Wiley & Sons, ISBN 0-471-96355-0): [cpp]inline int detect_addition_overflow(int a, int b, int overflow_value) { int result = a + b; if (result >= a) return result; e...
by Jordan Gordeev
Fri Jan 03, 2003 8:05 pm
Forum: C
Topic: linked lists
Replies: 7
Views: 3107

Not the underscore makes it work. It is the struct keyword.
See:
[c]typedef struct myStruct {
int data;
/*!!!*/myStruct *next;
};[/c]
[c]typedef struct _myStruct {
int data;
/*!!!*/struct _myStruct *next;
}myStruct;[/c]
by Jordan Gordeev
Fri Jan 03, 2003 8:01 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 18337

You have submitting problem. I guess you are using e-mail submission. Do you see the long one-line comment containing the word full? SMTP servers (the servers delivering electronic mail) and many e-mail clients love wrapping long lines, so what the judge receives is: // Check if both lines segments ...
by Jordan Gordeev
Fri Jan 03, 2003 7:45 pm
Forum: C
Topic: linked lists
Replies: 7
Views: 3107

What says the Online Judge, that is, what error message you get?
by Jordan Gordeev
Sun Dec 08, 2002 4:56 pm
Forum: Other words
Topic: Change user name on board?
Replies: 1
Views: 1440

You can delete your current username (from the Profile page) and then create new.
by Jordan Gordeev
Wed Dec 04, 2002 8:28 am
Forum: Algorithms
Topic: Minimum Cost Transport Algorithm
Replies: 3
Views: 2578

As far as I know this is a classical problem in Linear Programming
by Jordan Gordeev
Thu Nov 28, 2002 10:29 pm
Forum: C++
Topic: Old G++ version unacceptable
Replies: 4
Views: 2833

'Old C++ compiler unacceptable' and 'Compilation with optimization turned off unaccepteble' are two quite different things. I don't like the lack of optimization, but I understand the administrators, as they have only one computer to run a web server, mail server, to compile solutions and to run the...
by Jordan Gordeev
Wed Nov 20, 2002 8:44 am
Forum: C++
Topic: Grow Array Size
Replies: 13
Views: 4543

Your 'growing' code should not work as the two parts of the array, the one you allocate with [cpp]num = new int[5];[/cpp] and the one allocated with [cpp]pnum = new int[10];[/cpp] will be at different (not near) addresses in the general case. [cpp]pnum = &num[4];[/cpp] does nothing when followed by ...
by Jordan Gordeev
Sun Nov 17, 2002 2:02 pm
Forum: C++
Topic: Using Long Long s
Replies: 1
Views: 1633

I have extracted this from the manual for you:
To make an integer constant of type `long long int', add the suffix `LL' to the integer. To make an integer constant of type `unsigned long long int', add the suffix `ULL' to the integer.
by Jordan Gordeev
Sun Nov 17, 2002 1:53 pm
Forum: C++
Topic: Something's terribly wrong with long long ints
Replies: 1
Views: 1548

You should use
[cpp]scanf("%lld%lld", &a, &b);[/cpp]
or
[cpp]scanf("%Ld%Ld", &a, &b);[/cpp]
when reading long long ints and
[cpp]printf("%lld %lld\n", a, b)[/cpp]
or
[cpp]printf("%Ld %Ld\n", a, b)[/cpp]
when writing them.

Go to advanced search