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:Re:我怎用了这个公式还超时啊!!! Posted by:wujiabao at 2008-07-11 10:29:43 me too 下面这样的代码就会超时: __int64 getvalue (int n) { int i,c,l; __int64 ans; l = 0; for (i = 2; i < sqrt (n) + 1; i++) { c = 0; while (n % i == 0) { n /= i; c++; } if (c != 0) f[l++] = c; } len = l; ans = 1; for (i = 0; i < len; i++) { ans *= ((f[i] + 1) * (f[i] + 2)) * ((f[i] + 1) * (f[i] + 2)); } ans >>= (len + len); return ans; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator