389 - PE

The forum to report every bug you find or tell us what you'd like to find in UVa OJ

Moderator: Board moderators

Locked
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

389 - PE

Post by daveon »

My code outputs the following:

Code: Select all

ANSWER1\n
ANSWER2\n
ANSWER3\n
But I keep on getting PEs???
Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko »

I'm not sure, that one seems to be OK - do you print "ERROR" or " ERROR"?
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon »

Well, I used

Code: Select all

cout << "  ERROR" << endl;
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon »

Nevermind, I recoded it in C and got ACC.
Carlos
System administrator
Posts: 1286
Joined: Sat Oct 13, 2001 2:00 am
Location: Valladolid, Spain
Contact:

Post by Carlos »

Not nevermind!! Please, tell me the number of submission so that I can check it. Or send me the program.
DON'T PM ME --> For any doubt, suggestion or error reporting, please use the "Contact us" form in the web.
thurbo
New poster
Posts: 9
Joined: Wed Apr 05, 2006 2:00 pm
Location: Stockholm, Sweden

389 PE

Post by thurbo »

Going through my PE programs and I have PE for this problem as well.
Using C++/STL, I thought that maybe setw in combination with string could be a problem but the following gives PE too:

Code: Select all

struct Solution {
	string number;

	friend ostream& operator<<(ostream& strm, const Solution& solution) {
		if ( solution.number.length() > DIGITS )
			strm << "  ERROR";
		else if ( solution.number.length() == DIGITS )
			strm << solution.number;
		else
			strm << setw(DIGITS - solution.number.length()) << ' ' << solution.number;

		return strm;
	}
};
Newline characters are written in main:

Code: Select all

void main(void) {
	transform(istream_iterator<Problem>(cin), istream_iterator<Problem>(), ostream_iterator<Solution>(cout, "\n"), ProblemSolver());
}
The only thing I can think of is empty newlines in the input...
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon »

Perhaps I am using incorrect code to output.

The PE code:

Code: Select all

if(error) cout << "  ERROR" << endl;
else      cout << setw(7) << temp << endl;
The AC code:

Code: Select all

if(error) printf("  ERROR\n");
else      printf("%7s\n",temp);
Carlos
System administrator
Posts: 1286
Joined: Sat Oct 13, 2001 2:00 am
Location: Valladolid, Spain
Contact:

Post by Carlos »

Maybe it's the compilers problem. setw might not be well implemented....that will be solved when upgrading the compiler (new system again).

I've checked judge's output and I couldn't find anything wrong.

We'll leave this for now.
DON'T PM ME --> For any doubt, suggestion or error reporting, please use the "Contact us" form in the web.
Locked

Return to “Bugs and suggestions”