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:>>wa或者PE的注意了。。。

Posted by ludi at 2011-01-27 16:07:18 on Problem 1026
In Reply To:>>wa或者PE的注意了。。。 Posted by:scu_sadan at 2010-10-15 10:44:31
> 这个题目有几点注意的地方:
> 1)注意k可能很大,直接那样循环k次变换会TLE;因此必须寻找周期:
> 
> 如上面的
>  4 5 3 7 2 8 1 6 10 9
>  1 2 3 4 5 6 7 8 9 10
> 
> 则有如下置换规律:
> 1->4->7->1  
> 2->5->2
> .....
> 因此可把每一位的周期求出,然后只需进行k%time[i]次置换即可;
> 2)如果是PE的话,则要注意将目标串都初始化为‘ ’,还有在每个case后有个空行。

清空格,这个似乎没有必要,因为它的0..n-1位置都会被改写。
补充:3)不要忘了目标串[n] = 0;

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