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. 约瑟夫环用php实现

    百度百科的解释:约瑟夫环(约瑟夫问题)是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围.从编号为k的人开始报数,数到m的那个人出列:他的下一个人又从1开始报数,数 ...

  2. python文件备份脚本

    import osimport time source = ['D:\\MyDrivers\hotfix']   #这里可以用自然字符串表示r',因为windows下的分隔符与python的有冲突,所 ...

  3. Paxos 学习总结

    近期学习了分布式领域的重要算法Paxos,这里罗列下关键点当作总结.自己水平有限,难免存在谬误,恳请读者指正.本篇不包含Paxos的基本理论介绍.Paxos基础能够參考以下的学习资料章节. 1 Pax ...

  4. 当半年不碰的webpack + vuejs项目重见天日时遇到的神坑!

    半年前的Vuejs项目,由于webpack环境一直是1.0的(现在是webpack4.0),倒不是说不会升级或者不敢升级. 总而言之.在我再次启动这个项目时: npm run dev / npm ru ...

  5. java.long中的类和方法

    java.lang.Character.isUpperCase(char ch) 确定指定的字符是否为大写字符. java.lang.Character.toUpperCase()方法用法转换从Uni ...

  6. thread.join() 方法存在的必要性是什么?

    好久远的问题,为什么关注这个问题的人这么少? 或许是用到这个功能的情形比较少吧. 1.等待处理结果 为什么要用join()方法在很多情况下,主线程生成并起动了子线程,如果子线程里要进行大量的耗时的运算 ...

  7. 【cogs182】【USACO Jan07】均衡队形【st表】

    题目描写叙述 农夫约翰的 N (1 ≤ N ≤ 50,000) 头奶牛,每天挤奶时总会按相同的顺序站好. 一日.农夫约翰决定为奶牛们举行一个"终极飞盘"比赛.为简化问题.他将从奶牛 ...

  8. jquery简洁遮罩插件

    /************************** *Desc:提交操作时遮罩 *Argument:type=0 全屏遮 1局部遮 *Author:Zery-Zhang *Date:2014-09 ...

  9. Android注解支持(Support Annotations) (转)

    原文地址:http://www.flysnow.org/2015/08/13/android-tech-docs-support-annotations.html 注解支持(Support Annot ...

  10. 从零开始学android -- notification通知

    目前有三种通知 第一种是普通通知 看看效果 布局什么的太简单了我就不放在上面了给你们看核心的代码就行了 里面的   int notificationID = 1; //设置点击通知后的意图 Inten ...