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:15MS过,,谈谈我的思路.顺便给RE..TEL,..WA的同学一些数据....In Reply To:15MS过,,谈谈我的思路.顺便给RE..TEL,..WA的同学一些数据.... Posted by:zzyzzy12 at 2010-08-23 16:33:46 > data: > > 2146483648 2147483647 > 2146483811,2146483813 are closest, 2146841093,2146841273 are most distant. > 1 2 > There are no adjacent primes. > 1 100 > 2,3 are closest, 89,97 are most distant. > > --------------------------------------------------------------------- > 首先找出并将2~2^16的素数存在一数组中..然后在L...U中用这些素数以筛选法删除掉所有合数..最后扫描判断最近最远即可.. 我存了1-sqrt(INT_MAX)内的素数就可以了,我出的错误很奇怪,为了省点空间,用char数组(不会越界)做标记,单个输入总是正确,多个输入一起就出错了,后来加大了初始化元素个数才解决。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator