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

开始理解错题啦,如下打个32000的表就一次ac啦,0MS

Posted by wang521 at 2009-05-06 23:15:50 on Problem 1019

long long j,a[32001],s[32001];

int i,k;
	//打出数列到n共有多少位数
	a[1]=1;
	s[1]=1;
	for(i=2;i<=32000;i++)
	{
		if(i<10)
			a[i]=a[i-1]+1;
		else 
			if(i>=10&&i<100)
				a[i]=a[i-1]+2;
			else
				if(i>=100&&i<1000)
				   a[i]=a[i-1]+3;
				else
					if(i>=1000&&i<10000)
					  a[i]=a[i-1]+4;
					else
						a[i]=a[i-1]+5;

		s[i]=s[i-1]+a[i];
	}
	
	

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