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 |
我的也超时了!!#include <stdio.h> main() { int a[1501]={1500,1,0}; int n=1,i=2,j,m; while(i<1501) { n=n+1; j=n; while(j!=1) { if(j%2==0)j=j/2; else if(j%3==0) j=j/3; else if(j%5==0) j=j/5; else break; } if(j==1) {a[i]=n;i++;} } printf("please enter n'th ugly number:\n"); scanf("%d",&m); printf("%d",a[m]); } 请高人指点一下!! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator