Big Number-Asia 2002, Dhaka (Bengal) (计算位数)题解
Big Number
10
20
19
思路:
原来还有这种操作:求n的位数为(int)log10(n)+1,阶乘为相加后加1
code
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<cctype>
#include<queue>
#include<math.h>
#include<iostream>
#include<algorithm>
#define INF 0x3f3f3f3f
#define N 85
using namespace std;
int main(){
int t,n,i;
double sum;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
sum=0;
for(i=1;i<=n;i++){
sum+=log10(i);
}
printf("%d\n",(int)sum+1);
}
return 0;
}
Big Number-Asia 2002, Dhaka (Bengal) (计算位数)题解的更多相关文章
- HDU 1018Big Number(大数的阶乘的位数,利用公式)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1018 Big Number Time Limit: 2000/1000 MS (Java/Others) ...
- PHP简单的计算位数的函数
一个简单的PHP计算位数的函数: 1 <?php 2 //一个简单的计算字符串有长度的函数 3 #开始定义函数 4 function count_digit($number){ 5 $count ...
- Duanxx的C++得知:计算位数
一旦计算出一个数值数字,基本上它是不断分裂使用10.重新计,看看有多少个数字. 今天发现能够考虑先将数字转换为字符串,然后通过string.length获得数值的位数,这样做方便的多. string ...
- 2018 ACM-ICPC Asia Beijing Regional Contest (部分题解)
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranki ...
- 2014-2015 ACM-ICPC, Asia Xian Regional Contest(部分题解)
摘要 本文主要给出了2014-2015 ACM-ICPC, Asia Xian Regional Contest的部分题解,说明了每题的题意.解题思路和代码实现,意即熟悉区域赛比赛题型. Built ...
- Math Number 数值类 包装类 数学计算 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- HDU 1018 Big Number (log函数求数的位数)
Problem Description In many applications very large integers numbers are required. Some of these app ...
- input的类型为number,限制输入的数字位数
<input type="text" maxlength="5" /> 效果ok,当 <input type="number& ...
- The 2018 ACM-ICPC Asia Qingdao Regional Contest(部分题解)
摘要: 本文是The 2018 ACM-ICPC Asia Qingdao Regional Contest(青岛现场赛)的部分解题报告,给出了出题率较高的几道题的题解,希望熟悉区域赛的题型,进而对其 ...
随机推荐
- LoadRunner-录制脚本中文显示乱码
录制的脚本中中文字符显示乱码 在Tools->Recording Options中设置支持UTF-8即可
- Balls and Boxes---hdu5810(推公式)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5810 有n个球m个盒子,随机把球放到盒子中,求每个盒子球个数的方差的期望值 E[V]; 推公式吧,或者 ...
- Balanced Lineup---poj3264线段树基础
题目链接 求对应区间最大值与最小值的差: #include<stdio.h> #include<string.h> #include<algorithm> #inc ...
- maven国内稳定的阿里源
<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexu ...
- git分支名一直带rebasing,如何去除
git分支名一直rebasing, 使用git rebase --continue git rebase --skip git reset --abort 都没有用, 最后直接删除 当前目录下的.gi ...
- Floyd 判圈算法
Floyd 判圈算法 摘自维基百科, LeetCode 上 141题 Linked List Cycle 用到这个, 觉得很有意思. 记录一下. 链接: https://zh.wikipedia.or ...
- selenium webdriver显示等待时间
当页面加载很慢时,推荐使用显示等待:等到需要操作的那个元素加载成功之后就直接操作这个元素,不需要等待其他元素的加载 WebDriverWait wait = new WebDriverWait(dri ...
- Xcode 快捷键及代码格式化
按住apple键点击类名就可以定位到这个类中查看相关定义(在日后的开发中我们会经常这么来做,毕竟要记住iOS开发中所有的API是不现实的,有些API我们可以通过这种方法来查找) PS:下面都是网上百度 ...
- RAC禁用DRM特性
查看"_gc"开头的隐藏参数值: set linesize 333 col name for a35 col description for a66 col value for a ...
- 按照用户名和角色查询用户liferay
需求:当登录的用户输入用户的名字和角色的时候,模糊查询,然后就是Ajax的异步请求刷新界面 首先在一个工具类中写上一条你要写的sql语句代码如下: package com.ebizwindow.crm ...