http://acm.hdu.edu.cn/showproblem.php?pid=1018

题目大意  : 求一个数的阶乘的位数

公式log10(n!)=log10(1)+log10(2)+log10(3)+log10(4)...+log10(n)

有这公式  一切都看起来简单了一大把

#include <iostream>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;
#define N 1e7+7
#define memset(a,b) memset(a,b,sizeof(a)) int main()
{
int T;
scanf("%d",&T);
while(T--)
{
double sum=;
int n;
scanf("%d",&n);
for(int i=;i<=n;i++)
{
sum+=log10(i);
}
printf("%d\n",(int)(sum+));
}
return ;
}

Big Number--hdu1018(数学)的更多相关文章

  1. HDU 1018-Big Number(数学)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  2. PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)

    本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segmen ...

  3. poj1142.Smith Number(数学推导)

    Smith Number Time Limit: 1 Sec  Memory Limit: 64 MB Submit: 825  Solved: 366 Description While skimm ...

  4. uva 10706 Number Sequence(数学规律)

    题目连接:10706 - Number Sequence 题目大意:有一个有0 ~ 9组成的序列,1   1 2    1 2 3   1 2 3 4   1 2 3 4 5 ....就是第一位为1. ...

  5. CodeForces - 441E:Valera and Number (DP&数学期望&二进制)

    Valera is a coder. Recently he wrote a funny program. The pseudo code for this program is given belo ...

  6. 计蒜客 31452 - Supreme Number - [简单数学][2018ICPC沈阳网络预赛K题]

    题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than ...

  7. PAT Sum of Number Segments[数学问题][一般]

    1104 Sum of Number Segments(20 分) Given a sequence of positive numbers, a segment is defined to be a ...

  8. Codeforces Round #304 (Div. 2) D. Soldier and Number Game 数学 质因数个数

    D. Soldier and Number Game Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...

  9. HDU 6216 A Cubic number and A Cubic Number【数学思维+枚举/二分】

    Problem Description A cubic number is the result of using a whole number in a multiplication three t ...

  10. CodeForces - 1017 C. The Phone Number(数学)

    Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number! The ...

随机推荐

  1. Android String操作

    android String.valueOf(ch).getBytes("GBK") --------------------------------------------- S ...

  2. mycat 插入语句导致的一个Dobbo问题

    2017-01-03 11:11:52.621 [com.alib] (): [DUBBO] Send heartbeat to remote channel /121.43.177.8:20192, ...

  3. NGUI之UILabel

    重要属性说明 overflow: Shrink Content: 意味着内容会自动被缩小以便适应区域.它在你使用动态字体的同时使用Keep      Crisp设置时有效,让字体变小,而不是缩放内容. ...

  4. Android 获取设备信息 异常

    /**获取设备信息 * @param c * @return */ public static void setDeviceInfo(Context c,RequestParams params){ ...

  5. Struts2中的异常处理

    因为在Action的execute方法声明时就抛出了Exception异常,所以我们无需再execute方法中捕捉异常,仅需在struts.xml 中配置异常处理. 为了使用Struts2的异常处理机 ...

  6. 10G R2 参数文件相关

    CLUSTER_DATABASE Property Description Parameter type Boolean Default value false Modifiable No Range ...

  7. HEAP CORRUPTION 错误

    一般是new一块内存过小,  在这个内存块上写入的内容过大, delete时出现的错误; 如: char* ptr = new char[2]; //申请了两个字节 *ptr = "1234 ...

  8. HDU5878

    http://acm.hdu.edu.cn/showproblem.php?pid=5878 给出你一个数字,让你求出大于这个数字n并且是形如2^a*3^b*5^c*7^d的最小的数: 就是用打表法求 ...

  9. jquery tmpl遍历

    最近发现大家用模板渲染一些顺带逻辑功能代码块时,用jquery tmpl较多,遇到了一些问题,现在就个人以前研究过的一切常用功能作介绍,主要针对遍历,其它的大家可以自行浏览一起网站,如:http:// ...

  10. Excel—“撤销工作表保护密码”的破解并获取原始密码

    您是否遇到过这样的情况:您用Excel编制的报表.表格.程序等,在单元格中设置了公式.函数等,为了防止其他人修改您的设置或者防止您自己无意中修改,您可能会使用Excel的工作表保护功能,但时间久了保护 ...