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 14111206046 at 2016-05-31 13:06:30 on Problem 1032
In Reply To:请大家帮忙看看。拜托啦。。 Posted by:yinli2010 at 2010-07-20 11:02:16
> #include<stdio.h>
> void main()
> {int N,m,n,p,i;
> int a[50],b[50]={0};p=0;
> scanf("%d\n",&N);
> for(i=0;i<50;i++)
> a[i]=i;
> int res;
> res=a[2];
> if(N>=5&&N<=1000)
> {
> 	for(i=2; ;i++)
> 	{res+=a[i];b[i]=i;
> 	if(res>=N)break;
> 	}
> 	
>     if(res>=N)
> 	{
> 	m=(N-res+b[i])/(i-2);
> 	n=(N-res+b[i])%(i-2);
> 		for(int q=2;q<i;q++)
> 			b[q]=b[q]+m;
> 		i=i-1;
> 		while(i--)
> 		{
> 			p++;b[i]=b[i]+1;
> 			if(p=n)break;
> 		}
> 		
> 	}
> 	for(int l=2;l<=i+n;l++)
> 		printf("%d ",b[l]);printf("\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