1597 - Searching the Web
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
1597 - Searching the Web
Use this thread to discuss this problem.
Check input and AC output for thousands of problems on uDebug!
Re: 1597 - Searching the Web
Getting several PE but don't know what the problem is.
My idea is pretty simple.
For each query, iterate through all articles and all lines.
Print that line if it contains that query word.
The idea works fine, as I got a PE, not WA.
But the problem is why PE. I didn't find the point where I'm missing or adding any spaces.
Please help me, thanks.
My code is at below:
My idea is pretty simple.
For each query, iterate through all articles and all lines.
Print that line if it contains that query word.
The idea works fine, as I got a PE, not WA.
But the problem is why PE. I didn't find the point where I'm missing or adding any spaces.
Please help me, thanks.
My code is at below:
Code: Select all
Got AC. Thanks, nasher!
My problem was that I didn't remove the \n after the number of articles.
Therefore there's a new line in the article. Caused trouble at NOT operation.
Life shouldn't be null.