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 sothink at 2004-12-22 13:33:45 on Problem 2000
In Reply To:不明白 测试数据 小于1000时都是对的 请教阿~~ Posted by:scandrive at 2004-12-22 09:53:59
> #include <stdafx.h>
> #include <stdio.h>
> void main()
> {
> 	int n,i,k,j;
> 	long s,a[100005];
> 	scanf("%d",&n);
> 	while(n)
> 	{
> 		for(i=1,j=1;i<=n;i++)
> 		{
> 			for(k=i;k>=1;k--,j++)
> 				a[j]=(long)i;
> 		}
> 		for(s=0,i=1;i<=n;i++)
> 			s+=a[i];
> 		printf("%d %ld\n",n,s);
> 		scanf("%d",&n);
> 	}
> }
> 
> 
> 

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