Page 1 of 1

389 - PE

Posted: Fri Dec 29, 2006 5:10 am
by daveon
My code outputs the following:

Code: Select all

ANSWER1\n
ANSWER2\n
ANSWER3\n
But I keep on getting PEs???

Posted: Fri Dec 29, 2006 9:08 am
by Darko
I'm not sure, that one seems to be OK - do you print "ERROR" or " ERROR"?

Posted: Fri Dec 29, 2006 4:49 pm
by daveon
Well, I used

Code: Select all

cout << "  ERROR" << endl;

Posted: Fri Jan 05, 2007 4:25 am
by daveon
Nevermind, I recoded it in C and got ACC.

Posted: Fri Jan 05, 2007 7:22 pm
by Carlos
Not nevermind!! Please, tell me the number of submission so that I can check it. Or send me the program.

389 PE

Posted: Tue Jan 09, 2007 11:02 pm
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...

Posted: Sat Jan 13, 2007 5:45 pm
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);

Posted: Tue Jan 30, 2007 11:55 pm
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.