Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请大家帮忙看看。拜托啦。。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator