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 |
Re:时间卡的太死了In Reply To:时间卡的太死了 Posted by:GreatAccepted at 2010-02-12 14:24:37 1.用筛选法搜索3000以内素数便可,共有430个,可以先打表,然后把数字直接放到程序里面,不需要让提交的程序生成 如: int prime[]={2,3,5,7,11,...,2999}; 不需要程序里加 getprime() 2.指数不会超过30个,先计算30以内数值,即: int mat[30]={1,9,36,100,225,441,784,1296,2025,3025,4356,6084,8281,11025,14400,18496,23409,29241,36100,44100,53361,64009,76176,90000,105625,123201,142884,164836,189225,216225}; where mat[i]=(i+1)*(i+1)*(i+1)*(i+1)/4; 3.然后就照着常规的算,但是如此一来,也还是3900多ms,找不到别的优化方法了,若是大牛路过,留下思路吧~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator