hdu 3
来源:互联网 发布:凯立德找不到导航软件 编辑:程序博客网 时间:2024/05/29 08:31
题目意思是给一个数n,求n的阶乘一共有多少位,鉴于n的阶乘可能是一个大数,而且模拟乘法的过程非常麻烦,可以选择取10为底的对数:n!的位数 = log10 n!+1 = log10 (2) + log10(3) +…… log10(n) + 1 。
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <map>#include <algorithm>#include <cmath>#include <iomanip>#include <vector>#include <stack>#include <cstdlib>#include <queue>#include <set>#include <cctype>using namespace std;#define loop(i,u,v) for(int i = u;i <= v;i++)#define rloop(i,u,v) for(int i = u;i >= v;i--)#define eps 0.00000001int jiecheng(int a){ int n = 1; loop(i,2,a) n *= i; return n;}int main(){ int n,m; double a; cin >> n; while(n--) { cin >> m; a = 0; loop(i,2,m) a += log10(i); cout << int(a) + 1 << endl; } return 0;}
0 0
- hdu 3
- BestCoder #3 (HDU 4907 HDU 4908 HDU 4909 HDU 4910)
- hdu 1.2.3
- hdu 2064 汉诺3
- hdu 4609 3-idiots
- HDU 2.1.3 Cake
- hdu 4.1.3Cup
- HDU 1.3.3 排名
- HDU 2.1.3 Cake
- HDU 1.3.3 排名
- hdu 4609 3-idiots
- HDU 2064 汉诺塔3
- HDU 4609 3-idiots
- HDU 1.1.3
- HDU 4609 3-idiots
- hdu 4609 3-idiots
- 多校3 HDU
- HDU 4609 3-idiots
- 第一章 游戏开发环境-项目工具的选择
- Ccodeforces 27E Number With The Given Amount Of Divisors(数论+搜索)
- xCode - 静态库
- 利用Fiddler对Android模拟器网络请求进行抓包
- 灰盒测试技术
- hdu 3
- RESTful
- Leetcode 101. Symmetric Tree
- UIScrollView的相关内容
- Fiddler拦截http请求修改数据
- Leetcode 98. Validate Binary Search Tree
- java splite分割
- MarkDown使用
- Js年龄计算,精确到岁、月、小时