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;
}

 

最新文章

  1. rcnn学习(六):imdb.py学习
  2. Play Framework 完整实现一个APP(二)
  3. window 运行指令(1)
  4. sqlite3基础
  5. poj 1597 Uniform Generator【生成指定范围内所有随机数】
  6. iOS NSString 和NSData 转换
  7. Shell学习笔记 - 循环语句
  8. Jersey(1.19.1) - Client API, Proxy Configuration
  9. 【转】phpmyadmin万能密码漏洞
  10. Popen No such file or directory 错误
  11. ios音频视频资料--备用
  12. [置顶] ※数据结构※→☆线性表结构(list)☆============双向链表结构(list double)(三)
  13. PHP 7: PHP 变量和常量的定义
  14. 【PAT】反转链表
  15. linux iso 下载地址
  16. pycharm下打开、执行并调试scrapy爬虫程序
  17. js基本方法
  18. bzoj千题计划205:bzoj1966: [Ahoi2005]VIRUS 病毒检测
  19. 5.5 进入编辑模式 5.6 vim命令模式 5.7 vim实践
  20. 浅谈__dict__

热门文章

  1. 调用iPhone的短信
  2. 了解.net mvc实现原理ActionResult/View
  3. ListView滚动到底部判断
  4. MongoDB 的聚集操作
  5. Java银行调度系统
  6. 织梦DedeCMS自定义表单提交成功后返回当前页面的教程
  7. ps -ef 和 aux 区别
  8. SQL_为表和列加凝视
  9. Win7系统CMD命令提示符输入中文变乱码怎么办
  10. 简单记事本&amp;Java