fuliangliang的Blog

合抱之木,生于毫末;九层之台,起于累土;千里之行,始于足下。

用户操作
[即时聊天] [发私信] [加为好友]
fuliang
fuliang的公告

我的联系方式:20542606

Email:fuliangliang@gmail.com


最近评论
topgunqq:条理清楚,简单易学.比网上其他例子要好一些.至少按照楼主写的过程,我这个初学者实验成功了!
marshluca:恭喜~~
请问有没rails 做的项目,比方blog?
marshluca@gmail.com
marshluca:恭喜~~
请问有没rails 做的项目,比方blog?
marshluca@gmail.com
chucai:写的非常的好,仔细的拜读了。思路很清晰。考虑的问题也比较全面。
tbsc3:我也遇到了这个问题,如果配1 M就有用,大于2M就还是默认的 不知道你有没有解决呀,教教我
文章分类
收藏
    相册
    净月潭一日游
    页面图片
    日历
    文章收藏
    我的JavaEye博客
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 JOJ ACM 1107收藏

    新一篇: JOJ ACM 1149 | 旧一篇: JOJ ACM 1146

    The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest signal (in a little simplified view). Of course, BTSes need some attention and technicians need to check their function periodically.

    ACM technicians faced a very interesting problem recently. Given a set of BTSes to visit, they needed to find the shortest path to visit all of the given points and return back to the central company building. Programmers have spent several months studying this problem but with no results. They were unable to find the solution fast enough. After a long time, one of the programmers found this problem in a conference article. Unfortunately, he found that the problem is so called "Travelling Salesman Problem" and it is very hard to solve. If we have N BTSes to be visited, we can visit them in any order, giving us N! possibilities to examine. The function expressing that number is called factorial and can be computed as a product 1.2.3.4....N. The number is very high even for a relatively small N.

    The programmers understood they had no chance to solve the problem. But because they have already received the research grant from the government, they needed to continue with their studies and produce at least some results. So they started to study behaviour of the factorial function.

    For example, they defined the function Z. For any positive integer N, Z(N) is the number of zeros at the end of the decimal form of number N!. They noticed that this function never decreases. If we have two numbers N1<N2, then Z(N1) <= Z(N2). It is because we can never "lose" any trailing zero by multiplying by any positive number. We can only get new and new zeros. The function Z is very interesting, so we need a computer program that can determine its value efficiently.

     

    Input Specification

    There is a single positive integer T on the first line of input. It stands for the number of numbers to follow. Then there is T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.

     

    Output Specification

    For every number N, output a single line containing the single non-negative integer Z(N).

    Sample Input

    6
    3
    60
    100
    1024
    23456
    8735373
    

    Sample Output

    0
    14
    24
    253
    5861
    2183837
    
    #include<iostream>
    using namespace std;
    
    int main()
    {
    	int num,n,sum;
    	cin>>num;
    	while(num--)
    	{
    		sum=0;
    		cin>>n;
    		while(n/=5)
    		{
    		  sum+=n;
    		}
    		cout<<sum<<endl;
    	}
    	return 0;
    }
    

    发表于 @ 2006年01月17日 19:22:00|评论(loading...)|编辑

    新一篇: JOJ ACM 1149 | 旧一篇: JOJ ACM 1146

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © fuliang