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:暴力刚刚过,800多毫秒~~In Reply To:暴力刚刚过,800多毫秒~~ Posted by:beyonlin_SCUT at 2007-03-29 20:23:33 110ms bool is_prime(int n) { if (n==1) return false; if (n==2||n==3) return true; if (n%2==0) return false; if (n%3==0) return false; int i; for (i=6;(i-1)*(i-1)<=n;i+=6) { if (n%(i-1)==0) return false; if (n%(i+1)==0) return false; } return true; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator