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

朋友帮帮我啊~谢谢啦,TLE……

Posted by trueshlqsh at 2007-12-30 17:07:52 on Problem 3472
我找了个规律……但是要TLE。。。不知道有没有优化方法啊~~

--------------------------------------------我是可爱分割线--------------

先看这个表:
N      ANS   R     A      P
3     196   14    24    12
4    1444   38    60    20
5    9604   98   160    64
6   66564  258   416   156
……
ANS就是答案,R是大家肯定都发现的R*R=ANS
另外A和P是我自己拼出来的……有以下几个公式:
R(I+1)=R(I)+A(I)
A(I+1)=A(I)*3-P(I)
P(I+1)=[i为奇数]a(i)-4
      =[i为偶数]a(i)+4

额。。。跑了很多数据,包括50那个样例,规律应该没有问题……

---------------------------------------------我是可爱分割线-----------------

问题就是TLE,因为涉及到乘法,减法和加法的双高精,单高精……

有没有什么办法优化啊~~谢谢啦;)

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