Skip to content

Always trim first when parsing params.#171

Open
ShikChen wants to merge 1 commit into
zen0wu:masterfrom
ShikChen:patch-1
Open

Always trim first when parsing params.#171
ShikChen wants to merge 1 commit into
zen0wu:masterfrom
ShikChen:patch-1

Conversation

@ShikChen

Copy link
Copy Markdown

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