| ||||||||||
| 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 | |||||||||
提交时开500000是Runtime Error,改小些是wrong answer;在VC上开500000是要发送错误报告,改小些是能输出正确答案In Reply To:开500000不能运行,开小了又不合题意,怎么办呢? Posted by:zzzzzz at 2004-11-26 11:24:13 > #include<stdio.h>
> void main()
> {
> int a,j,n;long int sum[500000];
> scanf("%d",&n);
> while(n!=-1)
> {
> sum[0]=0;
> for(a=1;a<=n;a++)
> {
> if(sum[a-1]-a>0)
> {
> for(j=1;j<a;j++)
> {
> if(sum[a-1]-a!=sum[j])
> continue;
> sum[a]=sum[a-1]+a;
> goto loop;
> }
> sum[a]=sum[a-1]-a;
>
> }
> loop: if(sum[a-1]-a<=0) sum[a]=sum[a-1]+a;
> }
> printf("%d\n",sum[n]);
> 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