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:700多ms过的 用公式可以0ms飘过 那样就更水了In Reply To:Re:700多ms过的 用公式可以0ms飘过 那样就更水了 Posted by:980616701 at 2009-05-31 09:26:48 打了个表就266啦、、、 #include <stdio.h> int a[10000001]; int main() { int n,i,m,bit; double num; bit=1; num=1; for(i=1;i<=10000000;i++) { num*=i; if(num<10){a[i]=bit;continue;} if(num<100){num/=10;bit+=1;a[i]=bit;continue;} if(num<1000){num/=100;bit+=2;a[i]=bit;continue;} if(num<10000){num/=1000;bit+=3;a[i]=bit;continue;} if(num<100000){num/=10000;bit+=4;a[i]=bit;continue;} if(num<1000000){num/=100000;bit+=5;a[i]=bit;continue;} if(num<10000000){num/=1000000;bit+=6;a[i]=bit;continue;} if(num<100000000){num/=10000000;bit+=7;a[i]=bit;continue;} } scanf("%d",&n); while(n--) { scanf("%d",&m); printf("%d\n",a[m]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator