Big Number--hdu1018(数学)
http://acm.hdu.edu.cn/showproblem.php?pid=1018
题目大意 : 求一个数的阶乘的位数
公式log10(n!)=log10(1)+log10(2)+log10(3)+log10(4)...+log10(n)
有这公式 一切都看起来简单了一大把
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;
#define N 1e7+7
#define memset(a,b) memset(a,b,sizeof(a)) int main()
{
int T;
scanf("%d",&T);
while(T--)
{
double sum=;
int n;
scanf("%d",&n);
for(int i=;i<=n;i++)
{
sum+=log10(i);
}
printf("%d\n",(int)(sum+));
}
return ;
}
Big Number--hdu1018(数学)的更多相关文章
- HDU 1018-Big Number(数学)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- PAT甲级——1104 Sum of Number Segments (数学规律、自动转型)
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90486252 1104 Sum of Number Segmen ...
- poj1142.Smith Number(数学推导)
Smith Number Time Limit: 1 Sec Memory Limit: 64 MB Submit: 825 Solved: 366 Description While skimm ...
- uva 10706 Number Sequence(数学规律)
题目连接:10706 - Number Sequence 题目大意:有一个有0 ~ 9组成的序列,1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 ....就是第一位为1. ...
- CodeForces - 441E:Valera and Number (DP&数学期望&二进制)
Valera is a coder. Recently he wrote a funny program. The pseudo code for this program is given belo ...
- 计蒜客 31452 - Supreme Number - [简单数学][2018ICPC沈阳网络预赛K题]
题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than ...
- PAT Sum of Number Segments[数学问题][一般]
1104 Sum of Number Segments(20 分) Given a sequence of positive numbers, a segment is defined to be a ...
- Codeforces Round #304 (Div. 2) D. Soldier and Number Game 数学 质因数个数
D. Soldier and Number Game Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...
- HDU 6216 A Cubic number and A Cubic Number【数学思维+枚举/二分】
Problem Description A cubic number is the result of using a whole number in a multiplication three t ...
- CodeForces - 1017 C. The Phone Number(数学)
Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number! The ...
随机推荐
- Python filter,map,lambda,reduce,列表解析
filter用法 filter(func,seq) 将seq的元素逐一代入func,通过func的返回值来判断是保留还是过滤 >>> def foo(x): return x> ...
- day01-02--数据库概念介绍
什么是数据库呢?是存放数据的仓库.这个仓库比较特殊--它是按照一定的数据结构来组织.存储的.当然,我们也需要管理仓库中的货物--我们通过数据库提供的多种方法来管理数据库里的数据. 来自为知笔记(Wiz ...
- Mono addin 学习笔记 1
Mono Addin是一个开源的插件框架,其主要支持的特性如下: The main features of Mono.Addins are: Supports descriptions of add- ...
- 安卓:drawable
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...
- 如何利用tomcat和cas实现单点登录(2):配置cas数据库验证和cas客户端配置
接(1),上一篇主要讲述了tomcat和cas server端的部署. 接下来主要还有两个步骤. 注意:为了开启两个tomcat,要把直接配置的tomcat的环境变量取消!!!!!!!!!! 客户端配 ...
- java中的类型比较
Java 里的既可以比较基本类型也可以比较引用类型. 对于基本类型,Java 的==比较值比较 对于引用类型,Java 的==比较了引用的是否为同一个对象(比较内存地址), 也就是说这两个变量是否都指 ...
- ASP.NET 操作Cookie详解 增加,修改,删除
ASP.NET 操作Cookie详解 增加,修改,删除 Cookie,有时也用其复数形式Cookies,指某些网站为了辨别用户身份而储存在用户本地终端上的数据(通常经过加密).定义于RFC2109.它 ...
- JSONCPP安装
我刚刚开始从windows MFC下的开发转的LINUX下的C++开发.在写这篇文章之前我三次安装jsoncpp,每一次安装都犯不同的错误.为了我能够在下一次安装时不再犯错误.特写此文!JSONCPP ...
- Web开发新时代
Web1.0===主流技术:HTML+CSS Web2.0===主流技术:Ajax(Javascript/DOM/异步数据请求) Web3.0===主流技术:HTML5+CSS3 HTML5亮点:Ca ...
- 分布式Hbase-0.98.4在Hadoop-2.2.0集群上的部署
fesh个人实践,欢迎经验交流!本文Blog地址:http://www.cnblogs.com/fesh/p/3898991.html Hbase 是Apache Hadoop的数据库,能够对大数据提 ...