| ||||||||||
| 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:我ft 有是 cin cout 不如scanfIn Reply To:这个题目,不可能tle的,难道还有更好的算法,大家看看我的 Posted by:first at 2003-12-15 13:43:16 > void main()
> {
> int N,d,num5;
> int mult5[12];
> mult5[0]=5;
> int i;
> for(i=1;i<12;i++)
> mult5[i]=mult5[i-1]*5;
> cin>>N;
> while(N--)
> {
> cin>>d;
> num5=0;
> for(i=0;i<12;i++)
> if(d>=mult5[i])
> {
> num5+=d/mult5[i];
> }
> else
> break;
> cout<<num5<<endl;
> }
>
> }
> 这样tle
> while(N--)
> {
> cin>>d;
> num5=0;
> t=d/5;
> while(t)
> {
> num5+=t;
> t/=5;
> }
> cout<<num5<<endl;
> }
>
>
> 这样也tle ft了 5555 怎么做阿
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator