HDU 1066 Last non-zero Digit in N!(数论,大数,wait)
N N!
0 1
1 1
2 2
3 6
4 24
5 120
10 3628800
For this problem, you are to write a program that can compute the last non-zero digit of the factorial for N. For example, if your program is asked to compute the last nonzero digit of 5!, your program should produce "2" because 5! = 120, and 2 is the last nonzero digit of 120.
InputInput to the program is a series of nonnegative integers, each on its own line with no other letters, digits or spaces. For each integer N, you should read the value and compute the last nonzero digit of N!.
OutputFor each integer input, the program should print exactly one line of output containing the single last non-zero digit of N!.
Sample Input
1
2
26
125
3125
9999
Sample Output
1
2
4
8
2
8
HDU 1066 Last non-zero Digit in N!(数论,大数,wait)的更多相关文章
- hdu 1597 find the nth digit (数学)
find the nth digit Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- hdu 1597 find the nth digit
find the nth digit Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU 5053 the Sum of Cube(简单数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5053 题目大意: 求出A^3+(A+1)^3+(A+2)^3+...+B^3和是多少 解题思路: 设f(n)=1 ...
- HDU 5973 Game of Taking Stones 威佐夫博弈+大数
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5973 Game of Taking Stones Time Limit: 2000/1000 MS ...
- HDU 1316 (斐波那契数列,大数相加,大数比较大小)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1316 Recall the definition of the Fibonacci numbers: ...
- HDU 5666 Segment 数论+大数
题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5666 bc(中文):http://bestcoder.hdu.edu.cn/contests ...
- hdu 4043 2011北京赛区网络赛D 概率+大数 **
推出公式为:P = A(2n,n)/(2^(2n)*n!) 但是不会大数,学完java再补
- HDU 1715 大菲波数(JAVA, 简单题,大数)
题目 //BigInteger 和 BigDecimal 是在java.math包中已有的类,前者表示整数,后者表示浮点数 import java.io.*; import java.util.*; ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
随机推荐
- [洛谷P3521][POI2011]ROT-Tree Rotations
题目大意:给一棵$n(n\leqslant2\times10^5)$个叶子的二叉树,可以交换每个点的左右子树,要求前序遍历叶子的逆序对最少.输出最少的逆序对个数 题解:线段树合并,对于每个节点求出交换 ...
- BZOJ5011 [JXOI2017]颜色 【线段树 + 主席树】
题目链接 BZOJ5011 题解 一定只有我这种智障会用这么奇怪的方法做这道题.. 由题我们知道最后剩余的一定是一个区间,而且区间内的颜色不存在于区间外 所以我们的目的就是为了找到这样的区间的数量 区 ...
- 雅礼集训 Day3 T3 w 解题报告
w 题目背景 \(\frac 14\)遇到了一道水题,双完全不会做,于是去请教小\(\text{D}\).小\(\text{D}\)看了\(0.607^2\)眼就切掉了这题,嘲讽了\(\frac 14 ...
- 【CF edu 30 D. Merge Sort】
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 【CF Round 434 B. Which floor?】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- 深入浅出JavaScript变量作用域
在学习JavaScript的变量作用域之前,我们应当明确几点: JavaScript的变量作用域是基于其特有的作用域链的. JavaScript没有块级作用域. 函数中声明的变量在整个函数中都有定义. ...
- word公式编辑中的转义字符
Some of the commonly used symbols: \infty - Infinity \leq - Less then or equal \geq - ...
- java基础知识(二)-----多态和构造函数
一:前言 最近由于面试了新浪公司,面试官问我的问题我都不知道,觉得自己好菜,所以最近决定再把java基础给搞一遍,真的觉得自己好菜.每天看一点,那个家伙说<java编程思想>最少要看三遍, ...
- Liberty中应用的contextroot
参考:http://www-01.ibm.com/support/knowledgecenter/api/content/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ ...
- 【uva11468-Substring】AC自动机+dp
http://acm.hust.edu.cn/vjudge/problem/31655 题意:给定k个模板串,n个字符以及选择它的概率pro[i],要构造一个长度问L的字符串s,问s不包含任意一个模板 ...