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

哪位大哥能告诉我这个程序为什么re?在devc++上跑的很好啊……

Posted by wangchen1ren at 2005-02-17 21:42:27 on Problem 2081
#include <stdio.h>

main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    static int b[10000000];
    long c[500001];
    c[0]=0;
    long i;
    for(i=1;i<500001;i++)
      if (c[i-1]>i && b[c[i-1]-i]==0)
      {
          c[i]=c[i-1]-i;
          b[c[i]]=1;
      }
      else 
      {          
          c[i]=c[i-1]+i;
          b[c[i]]=1;
      }
    long n;
    scanf("%d",&n);
    while (n!=-1)
    {
        printf("%d\n",c[n]);
        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