2019年7月6日
为计划参加明年的Java蓝桥杯(大概2020年3月多) 但是不代表不会C和C++其实思想都是想通的
只是语言的描述不一样而已
准备时间还是挺长的
蓝桥杯比赛时间为 4个小时
结果填空
尾部的零
public class Solution {
/*
* @param n: An integer
* @return: An integer, denote the number of trailing zeros in n!
*/
public long trailingZeros(long n) {
// write your code here, try to do it without arithmetic operators.
long count = 0;
long temp = n/5;
while(temp != 0){
count = count+temp;
temp = temp/5;
}
return count;
}
}