The number of zero hdu1241 factorial

Source: Internet
Author: User

About number theory, the expression is basically ignorant, the most important thing is to have the idea of several, the problem of the numbers are converted to the idea of prime numbers, but there is no, so it is good to brush questions, slowly cultivate it.

The bottom 0 can only be 2*5=10, 2 appears more than 5, so calculate 5 appears in 1~n How many times, where 25=5*5 (2 times), 50=5*5*2;75=5*5*3, and so on.

eg:124/5=24;

24/5=4;

4/5=0.

There are always some stems to be understood by themselves .....

Topic links

1#include <cstdio>2#include <iostream>3 using namespacestd;4 intMain ()5 {6     intn,t;7Cin>>T;8      while(t--)9     {TenCin>>N; One         intres=0; A          while(n/5) -         { -res+=n/5; theN/=5; -         } -cout<<res<<Endl; -     } +     return 0; -}
View Code

The number of zero hdu1241 factorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.