Problem Description

In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.
 

Input

Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n lines, one integer 1 ≤ n ≤ 107 on each line.
 

Output

The output contains the number of digits in the factorial of the integers appearing in the input.
 

Sample Input

2
10
20
 

Sample Output

7
19


Sample Way

#include <stdio.h>
#include <math.h>

int main()     //用对数来解决位数过大溢出的问题
{
  int n,i,x;
  double counter;
  scanf("%d",&n);
  for(i=1;i<=n;i++)

  {

  scanf("%d",&x);

  x+=1;
  counter=0;
  while(--x)

  {
  counter+=log10(x);
  }
  printf("%d\n",(int)counter+1);
  }
  return 0;
}

 

hd acm1018的更多相关文章

  1. ATI Radeon HD 5450 with full QE/CI Support ( 转载 )

    ATI Radeon HD 5450 with full QE/CI Support - DSDT (Contains HDMI Audio Edit Too) & AGPM included ...

  2. XPS 15 9530使用Windows10频繁发生Intel HD Graphics 4600驱动奔溃的一种解决方法

    本人使用XPS 15 9530.集成显卡为Intel HD Graphics 4600.操作系统Windows 10 Pro,使用过程当中经常会发生集成显卡奔溃的问题,错误提示如下: Display ...

  3. Radeon HD 7850 vs Radeon R9 270X

    Radeon HD 7850 vs Radeon R9 270X  HW compare   Intro The Radeon HD 7850 comes with a GPU core speed ...

  4. 电影TS、TC、SCR、R5、BD、HD等版本是什么意思

    在很多电影下载网站的影片标题中我们都能看到,比如<刺杀希特勒BD版>.<游龙戏凤TS版>等,这些英文缩写都是什么意思呢?都代表什么画质?以下就是各个版本的具体含义: 1.CAM ...

  5. stm32类型cl、vl、xl、ld、md、hd的含义

    - startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices - startup_stm32f10x_ld.s: for ...

  6. 瑞昱Realtek(Realtek HD Audio Driver)音频声卡驱动R2.49 for Win7_Vista

    不管是在高端系列主板上,还是在低端系列主板上,我们都能看到Realtek瑞昱的身影,Realtek HD Audio Driver能够支持所有的Realtek HD Audio音频驱动.Realtek ...

  7. cocos2d-x 2.0.3 设置高清模式注意事项(已移除-hd方式)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=304 在cocos2d-x 2. ...

  8. %hd %d %ld %u ......

    %d 有符号10进制整数 %ld 长整型 %hd短整型%md,m指定的是输出字段的宽度,默认左补空格, 如果数据的位数小于m,则左端补以空格,若大于m,则 按实际位数输出,如: printf(&quo ...

  9. 求刷Kindle Fire HD的方法

    前几天入手了台Amazon Kindle Fire HD 其系统是经过Amazon尝试改造过的Android,用起来很不爽,想刷个CM10之类的,求教程和工具.

随机推荐

  1. 腾讯云DevOps 解决方案

    地址:https://www.qcloud.com/solution/devops 主要经历的几个阶段: 代码托管 持续集成与交互 测试管理 运维监控 项目管理 在上面图中都有,可以回过去查看.

  2. delphi的基本数据类型

    2017年06月07日 11:02:25 阅读数:402 分类 范围 字节 备注 简单类型 序数 整数 Integer -2147483648 .. 2147483647 4 有符号32位 Cardi ...

  3. asp.net core mvc视频A:笔记2-1.控制器定义

    方式一:以Controller结尾 方式二:不以Controller结尾 思考 默认路由规则为 运行示例(这里不需要写testcontroller,只写test就可以了) 同理测试test类中的控制器 ...

  4. 解决:cant&#39;t run &#39;/etc/init.d/rcS&#39;:No such file or directory

    Linux内核启动时提示这种错误:cant't run '/etc/init.d/rcS':No such file or directory 请用vim打开文件:/etc/init.d/rcS 观察 ...

  5. hdu 5371 Hotaru&#39;s problem【manacher】

    题目链接: http://acm.hdu.edu.cn/showproblem.php? pid=5371 题意: 给出一个长度为n的串,要求找出一条最长连续子串.这个子串要满足:1:能够平均分成三段 ...

  6. PHP 学习内容

    第一阶段: (PHP+MySQL核心编程) 面向对象编程 MySQL数据库, MySQL的优化细节. HTTP协议,http也是我们web开发的基石.对我们了解PHP底层机制有很大帮助,做到知其然,还 ...

  7. linux上安装Kafka

    写个一篇kafka文章了.但是那都是针对性能来说的,下面看一下完整的,kafka步骤: 安装单机三个 Broker 的 Kafka 集群,使用 Kafka 集群发布和接收消息.学完本课程,对 Kafk ...

  8. [转]postman 官方文档解说

    1. 安装 两种安装方式,我热衷于以chrome插件形式安装 Chrome插件 Mac App 2. 发送请求 Postman最基础的功能就是发送http请求,支持GET/PUT/POST/DELET ...

  9. Mac下python连接mysql数据库

    一.下载Mysql官方connector驱动 地址:https://dev.mysql.com/downloads/connector/python/ 根据提示安装.dmg文件即可. 二.验证是否安装 ...

  10. python设置环境变量

    方法1: 当程序开发完毕,就可以添加到 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages'中 ...