Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:java菜鸟来总结一下这道题的难点,以供后面WA和TLE的小伙伴们参考

Posted by swfxliyiyu at 2016-08-14 15:48:50 on Problem 1002
In Reply To:java菜鸟来总结一下这道题的难点,以供后面WA和TLE的小伙伴们参考 Posted by:shoujizhushou_JAVA at 2016-01-07 21:02:36
> 我的思路是直接把字符串转换成0000000-9999999的整数,然后比较统计
> WA原因有2:
>     一是遇到小于1000000的整数就输出错误,例如012-0000,我输出为12-0
>     二是忘了“No Duplicates.”这个例外了。。。
> TLE原因:
>    我的算法一开始是处理完一个字符串,就去寻找是否已经有相同的字符串,然后数目加1,后来发现当字符串数目很大(比如100000)这么做简直。。不说了,估计那个程序到现在也没跑完。
>    后来改成直接记录,然后用sort排序,再从前向后搜相同的整数(也就是相同的字符串)
> 
> 最后速度是4000多ms,刚好过。。。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator