Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么减枝仍旧TLE后来不得不把每个算出来的值记在2维数组里 才过了 bool solve(int p1,int p2,int p3) //表示判断s1,s2,s3的位置 {} 当s1[p1]!=s3[p3]&&s2[p2]!=s3[p3]时直接返回false; 但如果 s1[p1]==s3[p3]&&s2[p2]==s3[p3]的时候(第二个实例里t的时候)应该仍旧要算solve(p1+1,p2,p3+1)和solve(p1,p2+1,p3),然后2个结果或一下,这里面的重复计算怎么减掉? 就是说比如ttttttt tttttt tttttttttttt这种类型时,重算计算了很多怎么处理? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator