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

求助~~~~~~为什么运行结果为-171798692???郁闷~

Posted by 90405125 at 2004-12-23 18:42:08 on Problem 2000
#include<math.h>
#include<stdio.h>
void main(){
	int n[22],i,j,k,sum=0,left,t;
	for(k=0;k<22;k++){
	scanf("\n%d",&n[k]);
	if(n[k]==0)break;
	for(i=1;left>=0;i++){
		left=n[k]-i;
		t=i;
	}
	for(j=1;j<=t;j++)
		sum=sum+j*j;
	sum=sum+left*(t+1);
printf("%d %d\n",n[k],sum);

	}
}

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