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 |
怎么模拟? 我每次把剩下的数构成一个新的数组,可以节省很多运算量!但是还是TLE!但是在我电脑上感觉不出来很慢呀!输入3000立即就出来结果了!(内有程序,牛人帮下忙!)In Reply To:其实纯模也很快 Posted by:sunmoonstar_love at 2005-08-12 21:32:39 #include "stdio.h" #include "memory.h" int a[34000]; int n; int main() { int i,k,c,len,len1,p; while(1) { scanf("%d",&n); if(n==0) break; for(i=0;i<34000;i++) a[i]=i+2; c=0; len1=34000; while(1) { c++; if(c==n) break; k=0; p=a[0];i=0; while(k<len1) { if(k%p!=0) { a[i++]=a[k]; } k++; } len1=i; } printf("%d\n",a[0]); } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator