Last non-zero Digit in N!http://acm.hdu.edu.cn/showproblem.php?pid=1066 1 #include 2 #include 3 const int M=1024; 4 const int tomod[20]= {1,1,2,6,4,2,...
分类:
其他好文 时间:
2014-08-04 14:12:27
阅读次数:
308
Description
N children are sitting in a circle to play a game.
The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero integer on it in his/her hand. Th...
分类:
其他好文 时间:
2014-08-02 15:37:33
阅读次数:
259
最近做了浙大oj的第1011道题,遇见一件奇怪的事。这道题我用c++和php做,提交后都正确。但是用完全相同的逻辑改写成python代码提交后却产生了Non-zero Exit Code的判题结果。python的这一判题结果大多表示程序在运行过程发生了未捕捉的异常。经反复提交排查后确定未捕捉的异常是IndexError,也就是数组下标越界异常。进一步排查后确定应该是因为在测试用例中的树结点中有超过...
分类:
编程语言 时间:
2014-07-23 00:07:27
阅读次数:
498
找规律!求N!最后非0位的值。比方2是120的最后一个不是0的值。输入N比較大,要大数保存。注意到最后0的个数是与5的因数的个数相等。设f(n)为n!的最后非0位。那么f(n)=((n%5)!* f(n/5) *2^(n/5))%10因数2的个数始终大于5,从1開始每连续5个划分为1组,当中5的倍数...
分类:
其他好文 时间:
2014-07-05 17:28:05
阅读次数:
174
POJ 1150 The Last Non-zero Digit 数论+容斥
题目地址:
POJ 1150
题意:
求排列P(n, m)后面第一个非0的数。
分析:
为了熟悉题目中的理论,我先做了俩初级的题目:
POJ 1401,题解见:POJ
1401 && ZOJ 2202 Factorial 阶乘N!的末尾零的个数
NYOJ 954,题解见:NYO...
分类:
其他好文 时间:
2014-06-04 22:49:42
阅读次数:
322
mysql5.6.14配置my.cnf多实例,mysql_install_db初始化不读取my.cnf配置文件
[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a differentsize 768 pages (rounded down to MB) than specified in the .cnf file: initial65536 pages, max 0 (relevant if non-zero) pages!
2014-0...
分类:
数据库 时间:
2014-05-14 14:20:48
阅读次数:
412
1 /** 2 大意: 求A(n,m)的结果中从左到右第一个非零数 3 思路:
0是由2*5的得到的,所以将n!中的2,5约掉可得(2的数目比5多,最后再考虑进去即可) 4 那n!中2 的个数怎么求呢? 5 int get2(int n){
6 if(n==0) 7 re...
分类:
其他好文 时间:
2014-05-13 21:11:18
阅读次数:
302
Last non-zero Digit in N!Time Limit: 2000/1000 MS
(Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s):
5861 Accepted Submissio...
分类:
其他好文 时间:
2014-05-09 04:13:09
阅读次数:
360
Problem DescriptionThe expression N!, read as
"N factorial," denotes the product of the first N positive integers, where N is
nonnegative. So, for exa...
分类:
其他好文 时间:
2014-05-07 00:11:55
阅读次数:
353