Number of end 0 (problem source pythontip)

Source: Internet
Author: User

give you a list of positive integers L, the number of the end of the product of all numbers in the output L 0. (Hint: Do not multiply directly, the number is many, the result of multiplying can be very big).

For example: L=[2,8,3,50],

then output:2

using 2 and 5

Ideas:

there are several 2 and 5 of the factors that count.

Add up

take min

is the number of 0.

A pair of 2 and 5 is 10.

L = [2,8,3,50== 0 for in L:    While I% 2==0:        C2+=1        i/=2 while     i%5==0:        c5+=1        i/=5  Print(min (c2,c5))

Number of end 0 (problem source pythontip)

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.