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 |
Re:我O(N^2)的算法 200+MS过了,代码仅7行。。。。In Reply To:我O(N^2)的算法 100+MS过了,代码仅17行。。。。 Posted by:wiseking at 2009-10-27 21:39:50 int i,j,n,s[9999],a[9999],b[9999]; main(){ for(scanf("%d",&n);++i<n;)scanf("%d",s+i); for(i=n;0<i--;b[j]=a[i]=j) for(j=0;0<=s[i];s[i]--)for(j++;b[j];j++); for(i=0;i<n;i++)printf("%d\n",a[i]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator