| ||||||||||
| 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:不明白 测试数据 小于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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator