POJ 1401】的更多相关文章

POJ 1401 Factorial Time Limit:1500MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu   Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this ter…
题目:Factorial 题意:求N!末尾的0 的数量. 思路:10  = 2 * 5:N!中的2 的数量肯定比 5多:只需寻找5 的数量,暴力寻找TLE: 快点的方法:f(N) = N/5 + f(N/5) ; 我们知道,在1->60的数中,以下的数可以被5整除: 5,10,15,20,25,30,35,40,45,50,55,60 共60/5 = 12(个). 其中, 25,50可以被25整除,即25和50可以贡献两个5的因子. 即其中可以贡献2个5的因子的个数为60/25 = 2(个).…
#include<iostream>using namespace std;int main(){    int num;    int i;    int sum;    cin>>num;    int * noname=new int[num];    for(i=0;i<num;i++)        cin>>noname[i];    for(i=0;i<num;i++){        sum=0;        while(noname[i]…
题意:求一个数的阶乘最后边有几个0. 解法:如果有0说明这个数含有2和5这两个因子,对于一个阶乘来说因子2的数量一定比5的数量多,所以只要算有几个5就可以了,依次算5的个数,25的个数,125的个数……n以下的数字里含有因子5的数的个数是⌊n / 5⌋,含有因子25的数的个数是⌊n / 25⌋,以此类推,但是不需要因为25是平方就乘2,只要加上这个数就可以了,因为算5的时候已经数过一次25了. 代码: #include<stdio.h> #include<iostream> #in…
一.Description 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…
Factorial Time Limit: 1500MS   Memory Limit: 65536K Total Submissions: 15137   Accepted: 9349 Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term…
POJ 1150 The Last Non-zero Digit 数论+容斥 题目地址: id=1150" rel="nofollow" style="color:rgb(0,136,204);text-decoration:none;">POJ 1150 题意:  求排列P(n, m)后面第一个非0的数. 分析: 为了熟悉题目中的理论.我先做了俩0基础的题目: id=1401" rel="nofollow" style…
转载请注明出处:http://blog.csdn.net/lttree Factorial Time Limit: 1500MS   Memory Limit: 65536K Total Submissions: 13993   Accepted: 8678 Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers for…
明出处:http://blog.csdn.net/lttree Factorial Time Limit: 1500MS   Memory Limit: 65536K Total Submissions: 13993   Accepted: 8678 Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form th…
在学习循环控制结构的时候,我们经常会看到这样一道例题或习题.问n!末尾有多少个0?POJ 1401就是这样的一道题. [例1]Factorial (POJ 1401). Description 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…