Input Question

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Wolfgang Haas
New poster
Posts: 2
Joined: Tue Oct 21, 2003 4:41 am

Input Question

Post by Wolfgang Haas »

If a problem's input consists of lines with 2 integers and is not terminated by any special numbers, what should my termination condition look like?

I.e. Input:
1 2
5 3
6 2
4 1

I was using while (cin >> num1 >> num2), but when I submitted the problem I got "time limit exceeded".

I just wanted to find out if it's because how I handle the input, or if my program is just too slow...
UFP2161
A great helper
Posts: 277
Joined: Mon Jul 21, 2003 7:49 pm
Contact:

Post by UFP2161 »

That should work.
anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam »

check out the algorithm you used. and also the arraysize.
"Everything should be made simple, but not always simpler"
Post Reply

Return to “C++”