| ||||||||||
| 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 | |||||||||
哪位牛人可以帮忙解释一下?这样为什么可以啊?看不懂什么意思!In Reply To:我O(N^2)的算法 100+MS过了,代码仅17行。。。。 Posted by:wiseking at 2009-10-27 21:39:50 for(i=2;i<=n;i++){
scanf("%d\n",&k);
k++;
for(j=i;j>k;j--)a[j]=a[j-1];
a[k]=i;
};
for(i=1;i<=n;i++)f[a[i]]=i;
for(i=1;i<=n;i++)cout<<f[i]<<endl;
貌似以前见过这个写法,可是看了老半天,真的看不懂!
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator