Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always trim first when parsing params. #171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ShikChen
Copy link

Sometimes even a simple string param may have redundant spaces like sample 2 in BagAndCards (SRM 679). Always trim first when parsing params will fix this.

The incorrect BagAndCards.sample is given below. Note that there is a trailing space in sample 2.

I have debugged my solution for quite a while and found this bug in Greed during the contest...QQ

-- Example 0
2
4
1
1
0
0
NNYYNYN

9
-- Example 1
3
5
1
1
1
2
NNYYNYNYN

1532
-- Example 2
10
20
111
222
333
444
"NNNNNYYYNNNYYYYYYNNYYYYNNNNYNNYYYNNNYYN" 

450750683
-- Example 3
2
2
1
1
0
0
NNY

1

Sometimes even a simple string param may have redundant spaces like sample 2 in BagAndCards (SRM 679).
Always trim first when parsing params will fix this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant