1045 - Digits of Factorial Factorial of an integer is defined by the following function f(0) = 1 f(n) = f(n - 1) * n, if(n > 0) So, factorial of 5 is ...
分类:
其他好文 时间:
2017-08-01 09:51:31
阅读次数:
180
You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For e ...
分类:
其他好文 时间:
2017-07-29 12:44:02
阅读次数:
117
1028 - Trailing Zeroes (I) We know what a base of a number is and what the properties are. For example, we use decimal number system, where the base i ...
分类:
其他好文 时间:
2017-07-29 11:36:47
阅读次数:
193
#####调试 #####查看日志与断言 ''' 抛出异常使用raise语句.在代码中,raise语句包含以下部分: (1)raise关键字; (2)对Exception函数的调用; (3)传递给Exception函数的字符串,包含有用的出错信息 ''' ###################### ...
分类:
编程语言 时间:
2017-07-26 23:37:58
阅读次数:
437
Consider two integer sequences f(n) = n! and g(n) = an, where n is a positive integer. For any integer a > 1 the second sequence is greater than the f ...
分类:
其他好文 时间:
2017-07-24 13:03:17
阅读次数:
150
题意:求n的k次方所得到的数的前三位和后三位。 分析: 1、后三位快速幂取模,注意不足三位补前导零。 2、前三位: 令n=10a,则nk=10ak=10x+y,x为ak的整数部分,y为ak的小数部分。 eg:n=19,k=4,则nk=130321, a=log10(n)=1.278753600952 ...
分类:
其他好文 时间:
2017-07-23 21:18:54
阅读次数:
180
题意:求 n^k 的前三位和后三位。 析:后三位,很简单就是快速幂,然后取模1000,注意要补0不全的话,对于前三位,先取10的对数,然后整数部分就是10000....,不用要,只要小数部分就好,然后取前三位。 代码如下: ...
分类:
其他好文 时间:
2017-07-23 21:09:37
阅读次数:
155
题目链接:https://vjudge.net/problem/LightOJ-1282 题目大意: 给出一个数n,求n^k次方后的数的前三位和后三位的值。 题目分析: 对于数的后三位可以直接用快速幂取模的方法求得。 求数的前三位,可以先对n^k取log10,此时得到 x=k*log10(n),即1 ...
分类:
其他好文 时间:
2017-07-23 12:29:28
阅读次数:
148
注意:构造方法不可递归,否则是无限创建对象;递归的几个经典例子:1.HannoiTower 1 import java.util.Scanner; 2 public class HanoiTower{ 3 //level代表盘子个数;三个char类型代表柱子 4 public static void... ...
分类:
其他好文 时间:
2017-07-06 23:53:06
阅读次数:
287
1. 在shell文件内部定义函数并引用: 复制代码代码如下: [~/shell/function]# cat factorial.sh #!/bin/bashfunction factorial{factorial=1for (( i=1;i <= $1;i++ )) do factorial=$ ...
分类:
系统相关 时间:
2017-06-25 18:35:08
阅读次数:
255