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

哪位牛人可以帮忙解释一下?这样为什么可以啊?看不懂什么意思!

Posted by 540907010146 at 2010-07-24 17:40:49 on Problem 2182
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:
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