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

分析得很细!

Posted by qrmajia at 2009-02-24 22:01:11 on Problem 2346 and last updated at 2009-02-24 22:04:42
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:
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