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. jQuery的$.fn使用

    jquery中文网为您提供jQuery的$.fn使用等资源,欢迎您收藏本站,我们将为您提供最新的jQuery的$.fn使用资源 $.fn是指jquery的命名空间,加上fn上的方法及属性,会对jque ...

  2. eureka集群高可用配置,亲测成功配置(转)

    转自大神的文章:https://blog.csdn.net/tianyaleixiaowu/article/details/78184793 网上讲这个东西的很多,抄来抄去的,大部分类似,多数没讲明白 ...

  3. 怎样新建Quartusproject—FPGA新手教程

    这一章我们来实现第一个FPGAproject-LED流水灯.我们将通过流水灯例程向大家介绍一次完整的FPGA开发流程,从新建project,代码设计,综合实现.管脚约束,下载FPGA程序. 掌握本章内 ...

  4. Maven的配置地址

    http://howtodoinjava.com/tools/eclipse/how-to-import-maven-remote-archetype-catalogs-in-eclipse/ htt ...

  5. 在多点环境下使用cas实现单点登陆及登出

    CAS 介绍 CAS 是 Yale 大学发起的一个开源项目,旨在为 Web 应用系统提供一种可靠的单点登录方法,CAS 在 2004 年 12 月正式成为 JA-SIG 的一个项目.CAS 具有以下特 ...

  6. GreenDao学习

    官方文档地址:http://greenrobot.org/greendao/documentation//introduction/ 英语不好的可以使用谷歌翻译,很轻松的看懂文档,不需要FQ. 看不懂 ...

  7. python 装饰器 (个人理解就是前置的内建函数)

    感谢有篇文件详细介绍[简单 12 步理解 Python 装饰器]http://python.jobbole.com/85056/ 1.首先介绍内建函数 2.转换为装饰器 3.执行顺序 4.装饰器实用

  8. SQL_为表和列加凝视

    ***********************************************声明*************************************************** ...

  9. wordcloud使用

    学了下怎么用wordcloud. 以imet的数据集为例 https://www.kaggle.com/c/imet-2019-fgvc6 读取“train.csv”,”label.csv”文件,得到 ...

  10. <button>标签也能提交表单问题

    如何避免<button>标签也能提交表单的问题: 只需加上一个属性:type='button'即可:如<button type="button"> < ...