| ||||||||||
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 |
帮帮小弟吧。。。这样也能超时?和解题报告的方法完全一样。。。。 整个程序就是在分解x,计算重复元素排列。。。一点无用功也没做。。。。。 为了分解得快,连素数表都搬出来了。。。。。 还是超时。。。。 苍天啊!大地啊! 。。。。。。。。 素数表只贴了一部分,如果不够用的话本应该RE,但是还是给我超时。。。说明还是超时的问题。。。。 大哥!帮我看看吧!! #include<stdio.h> int su[124]={2, 3, 5, 7 ,11 ,13 ,17, 19, 23, 29 ,31, 37, 41 ,43 ,47 ,53 ,59 ,61 ,67 ,71 ,73, 79 ,83 ,89 ,97 ,101 ,103 ,107, 109, 113 ,127 ,131 ,137 ,139 ,149,151 ,157 ,163, 167 ,173 ,179, 181 ,191 ,193 ,197 ,199 ,211, 223, 227, 229 ,233 ,239, 241 ,251, 257, 263, 269 ,271, 277 ,281, 283 ,293 ,307, 311, 313,317 ,331, 337, 347, 349 ,353, 359, 367 ,373 ,379 ,383 ,389, 397, 401, 409, 419, 423 ,431 ,433 ,439 ,457,461 ,463, 467, 479 ,487 ,491 ,499 ,503, 507, 521, 523, 541 ,547 ,557 ,563, 569 ,571, 577, 587, 593, 599, 601 ,607, 613 ,617 ,619 ,631, 641 ,643, 647, 653, 659 ,661 ,673, 677 ,683 ,691 ,701}; main() { long int x; int lenth; long int nchain; long int chu; long int dup; while(scanf("%d",&x)!=EOF) { nchain=1; lenth=0; chu=0; dup=1; while (x>1) if (x%su[chu]==0) { x=x/su[chu]; lenth++; nchain*=lenth; nchain/=dup; dup++; } else { chu++; dup=1; } printf("%d %d\n",lenth,nchain); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator