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:靠!我这么完美的程序居然不过!

Posted by maxflying at 2005-12-21 15:29:27 on Problem 2000
In Reply To:靠!我这么完美的程序居然不过! Posted by:zzzzzz at 2004-11-22 13:08:42
> #include<stdio.h>
> void main()
> {
> 	int day[21],i,j,sum,m,k=0;
> 	for(j=0;j<21;j++)
> 	{
> 		scanf("%d",&day[j]);
> 		if(day[j]==0)break;
> 	}
> 	
> 		while(day[k]!=0)
> 		{
> 		  sum=0;
> 	      for(i=1;i<100;i++)   //100 is not big enough !
> 		  {  
> 		   sum+=i;
> 		   if(sum>=day[k])break;
> 		  }
>           m=0;
> 	      for(j=1;j<=i;j++)
> 	      m+=j*j;
> 	      m=m-(sum-day[k])*i;
> 	      printf("%d %d\n",day[k],m);
> 		  k++;
> 	 }
> }
as far as I know:
// for(i=1;i<100;i++)   //100 is not big enough !

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