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

为什么runtime error ?结果都对啊!大牛们帮我看看吧~~

Posted by RJXY0711 at 2007-07-29 21:58:43 on Problem 1701
#include<Stdio.h>
int up(int a,int n)
{ return   n * a + 0.5 *n * (n - 1) ;
}
int down(int b,int n)
{ return  n * b + 0.5 * n * (n- 1) ;
}
void main()
{int a,b,i,j,s,t,m,k[100],sum=0,dis,lift;
scanf("%d",&t);
for(i=0;i<t;i++)
{scanf("%d%d%d",&m,&a,&b);
for(j=0;j<m;j++){
scanf("%d",&k[j]);}
for(j=0;j<m;j++ ){
for(s=0;s<m;s++)
{if(s==j) ;
else if(s>j) sum+=k[s]*up(a,s-j);
else sum+=k[s]*down(b,j-s);}
if(j==0||sum<dis)
{dis=sum;sum=0;lift=j+1;}
}printf("%d\n",lift);
} 
}

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