HDU 1108
Big Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 38440 Accepted Submission(s): 18627Problem DescriptionIn 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.InputInput 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.OutputThe output contains the number of digits in the factorial of the integers appearing in the input.Sample Input21020Sample Output719
t+=log10(i*1.00);
sum=int(t)+1;
这样就很好的求出位数了。
代码:
1 #include<iostream>
2 #include<stdio.h>
3 #include<string.h>
4 #include<cmath>
5 #include<math.h>
6 using namespace std;
7 int main(){
8 int T;
9 cin>>T;
10 while(T--){
11 int n;
12 scanf("%d",&n);
13 int sum=0;
14 double t=0.0;
15 for(int i=1;i<=n;i++){
16 t+=log10(i*1.00);
17 }
18 sum=int(t)+1;
19 cout<<sum<<endl;
20 }
21 return 0;
22 }
HDU 1108的更多相关文章
- HDU 1108 最小公倍数
#include <cstdio> int gcd(int a,int b) { ) return a; else return gcd(b,a%b); } int main() { in ...
- HDU 1222 - Wolf and Rabbit & HDU 1108 - [最大公约数&最小公倍数]
水题,只是想借此记一下gcd函数的模板 #include<cstdio> int gcd(int m,int n){return n?gcd(n,m%n):m;} int main() { ...
- HDU 1108.最小公倍数-辗转相除法
最小公倍数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
- hdu 2503 1713 1108 最小公倍数&最大公约数
gcd模板: __int64 gcd(__int64 a,__int64 b) { retur b==0?a:gcd(b,a%b); } 1108: #include<iostream> ...
- ZOJ 1108 FatMouse's Speed (HDU 1160) DP
传送门: ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=108 HDU :http://acm.hdu.edu.cn/s ...
- ZOJ 1108 & HDU 1160 - FatMouse's Speed
题目大意:给你n只老鼠的体重w和速度s,让你找出最长的子序列使得w[i] < w[j] 且 s[i] > s[j] (i < j).求最长序列的长度并输出该序列. LIS(Longe ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- HDU 4422 The Little Girl who Picks Mushrooms(简单题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4422 题目大意:小姑娘背着5个包去山上采蘑菇,每座山上只能用一个背包采集.三个小精灵会要她3个背包,其 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
随机推荐
- Azure Storage 系列(八)存储类型细化分类说明
一,引言 Azure 存储账户功能经过官方改进迭代后,在创建的时候,存储账户的类型被分为两大类: 1)general-purpose v2 account(标准常规用途v2) Blob 存储,队列存储 ...
- sql-labs--Less-1--Error based-Single quotes
sql="SELECT * FROM users WHERE id='id' LIMIT 0,1"; 打开第一关,我们看到如下界面,上面写着Please input the ID ...
- js调起android安卓与ios苹果方法 vue3.0 + ts
let shareSelect = (ev :any) => { const u :any= navigator.userAgent; const win :any = window const ...
- IOS苹果应用IPA一键签名工具(苹果重签名,企业签名,Windows平台,时间控制)
苹果应用IPA一键签名工具可以在windows平台对苹果应用IPA文件重新签名,无需MAC苹果电脑和配置XCODE开发环境,便可以直接对IPA文件进行签名,同时支持修改BundleID, 不受描述文件 ...
- Linux服务器搭建环境复盘
Linux服务器搭建环境复盘 Linux服务器上是没有开发环境的,需要自己配置,在获得了服务器账号后,通过WinSCP登录可以传文件. 下载anaconda 官网下载Anaconda Linux版本 ...
- SQL函数Intersect,except整理
1. 集合函数使用的规则 ① 每个集合要求列数量相同,列顺序相同. ② 每个集合显示的列,要求数据类型一致或者可隐式转换成同一数据类型 ③ 最终集合列名称与第一个集合的列名称一致 2. ...
- 彻底弄懂ip掩码中的网络地址、广播地址、主机地址
本文为博主原创,转载请注明出处: 概念理解: IP掩码(或子网掩码)用于确定一个IP地址的网络部分和主机部分.它是一个32位的二进制数字,与IP地址做逻辑与运算,将IP地址划分为网络地址和主机地址两部 ...
- 爬虫系列——requests
文章目录 一 介绍 二 基于GET请求 三 基于POST请求 四 响应Response 五 高级用法 一 介绍 介绍:使用requests可以模拟浏览器的请求,比起之前用到的urllib,reques ...
- Ubuntu 14.04解决登录界面无限循环的方法
在Ubuntu下配置Android的环境时,想像在Windows中那样在终端中直接启动adb,以为Linux和Windows一样,将adb的路径添加到环境变量中,于是将adb的路径也export到/e ...
- EMC ndmp NAS
NAS 是带存储系统的专用高性能文件服务器.它可提供文件级数据访问和共享. NAS 使用网络和文件共享协议,包括用于数据传输的 TCP/IP 以及用于远程文件服务的 CIFS 和 NFS. 最简单的备 ...