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. Handler基本概念

    Handler基本概念: Handler主要用于异步消息的处理:当发出一个消息之后,首先进入一个消息队列,发送消息的函数即刻返回,而另外一个部分逐个的在消息队列中将消息取出,然后对消息进行出来,就是发 ...

  2. Android String操作

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

  3. 每天一个 Linux 命令(5):rm 命令

    昨天学习了创建文件和目录的命令mkdir ,今天学习一下linux中删除文件和目录的命令: rm命令.rm是常用的命令,该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所 ...

  4. 面向对于javascript编程

    以构造函数的方式定义对象 function Person(name, age) { this.name = name; this.age = age; this.sayName = function ...

  5. 剑指Offer:面试题20——顺时针打印矩阵(java实现)

    题目描述: 输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数 字,例如,如果输入如下矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1, ...

  6. dedecms代码研究三

    上次,我们从dedecms的index.PHP文件中了解到了很多信息,也提出了一些问题: 1)加载了/include/common.inc.php,里面做了哪些工作? 2)/include/arc.p ...

  7. PCI Express(一)- Connector

    在FPGA4FUN上看到一篇介绍PCI-E的帖子,简单易懂,适合入门,特地搬过来 原文地址:http://www.fpga4fun.com/PCI-Express.html 前言: As PCI Ex ...

  8. android开发 如何调用SO

    java package com.example.callsodemo; import android.R.integer; import android.R.string; import andro ...

  9. 深入理解js——继承

    JavaScript中继承是通过原型链来体现的. function Foo(){} var f1=new Foo(); f1.a=10; Foo.prototype.a=100; Foo.protot ...

  10. HTML插入Flash的全兼容完美解决方案-SWFObject

    Flash 嵌入的问题朋友们可能认为很简单,但是具体到一些问题上来讲,就不是那么简单了,比如:IE浏览器对FLASH的拦截虚框怎么去掉?在FF.OP.NS等其它浏览器是否兼容?代码是否符合W3C标准? ...