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. jspSmartUpload上传下载全攻略

    http://blog.itpub.net/92037/viewspace-788900/

  2. DATAGUARD 添加修改REDOLOG大小

    DG在线日志组大小修改 环境(单实例,Centos 6.5 X64,oracle 10.2.0.5,filesystem存储) REDO ONLINE LOG select * from v$logf ...

  3. 洛谷P3367 【模板】并查集

    P3367 [模板]并查集 293通过 551提交 题目提供者HansBug 标签 难度普及- 提交  讨论  题解 最新讨论 不知道哪错了 为啥通不过最后三个节点 题解 不懂为什么MLE 最后一个数 ...

  4. WinServer2008r2 机器时间格式修改

    windows2008 这么高级的系统不可能改个系统的日期时间显示格式还要进注册表啊.于是有baidu,google了下终于发现了,原来还有不需要注册表的更简便方法.windows2008默认时间格式 ...

  5. Centos 6 之samba 搭建

    学习linux从实践做起. 实验环境:vmware,cenots 6,xshell 注意:使用vmware 时,网络连接设置成桥接,和宿主机位于同一个网段. 实验需求:模拟实际公司文件服务器. 新建S ...

  6. 在.net桌面程序中自定义鼠标光标

    有的时候,一个自定义的鼠标光标能给你的程序增色不少.本文这里介绍一下如何在.net桌面程序中自定义鼠标光标.由于.net的桌面程序分为WinForm和WPF两种,这里分别介绍一下. WinForm程序 ...

  7. DropDownList怎样动态绑定数据库中的某一条数据

    用Ajax动态绑定数据库的数据:点击后台查看代码,编写代码如下 if (!IsPostBack) { using (SnailTechDataContext con = new SnailTechDa ...

  8. visual studio installer制作安装包——Installer 类

    链接:https://msdn.microsoft.com/zh-cn/library/system.configuration.install.installer.aspx Installer 类 ...

  9. DIOCP之注册编码解码器与ClientContext

    FTcpServer.registerCoderClass(TIOCPStreamDecoder, TIOCPStreamEncoder);//注册编码器与解码器 FTcpServer.registe ...

  10. asp.net GridView控件的列属性

    BoundField 默认的数据绑定类型,通常用于显示普通文本 CheckBoxField 显示布尔类型的数据.绑定数据为TRUE时,复选框数据绑定列为选中状态:绑定数据为FALSE时,则显示未选中状 ...