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 |
分析得很细!In Reply To:此题DP做法 Posted by:FOXLIU at 2008-09-21 01:00:16 "那就可以先求出 (n/2) 位的所有数字中,各位数字之和为 0、1、2、……、(n/2)*9 的数字的个数,再求出这些个数的平方和就可以了。" 其实有这一句话就够 了,ans=a[n/2][]*a[n-n/2][],因为n/2<=5,所以只要求出1个数字,2个数字,,,,5个数字的0到(令m=n/2)(m-1)*m/2之间出现的次数就行了, 总耗时是9+99+999+9999+99999+(m-1)*m/2, 然后再累乘起来 for(i=0;i<=(m-1)*m/2;++i)ans+=a[n/2][i]*a[n-n/2][i]; ans 便是结果 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator