|
|
back to boardjava.util.HashSet.add() method When I used this code: if (q == 0) { out.println(fullName); return; } if (set.add(name)) q--; I got WA 2. Then I replaced it by: set.add(name); if (set.size() > q) { out.println(fullName); return; } and got AC. So, can anybody explain me why? JavaDoc says: "Returns: true if this set did not already contain the specified element", or, in our problem, if this team is the first team of this university. Can you give me a test where my first solution gets WA, and the second gets AC? P.S. I got AC WITHOUT any comparing in lowercase! Edited by author 07.06.2010 14:12 |
|
|