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

458 ms 好险,说一下我的思路,针对TLE的

Posted by peng494563814 at 2010-05-06 17:52:19 on Problem 1026 and last updated at 2010-05-06 17:59:06
假设变换函数为f(int a[],char c[]);
首先直接根据输入的次数m,经过m次变换,是行不通的
因为这个次数m可能很大

一个行不通的办法是:假设k次变换后进入循环,先求出k,然后再进行m%k次变换
因为k值可能很大,所以行不通,两次都TLE;

一个可行的思路是:先进行100次变换,求出与这个变换对应的数组b[],
               然后,进行m/100次数组b[]变换 <即f(int b[],char c[]);>
                 再进行m%100次数组a[]变换

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