简单数学题(水的不能在水的题了)

跟kuangbin聊过之后开始知道怎么做了,先刷着,慢慢就积累了,慢慢的就都会了,知识点也都会慢慢的积累的

先小小的试一下

big number

题目描述

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 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.

题意:

就是求n的阶乘有多少位数

log(m*n)=log(m)+log(n)

然后(int)log10(n)+1就是这个数对应的位数

代码:

#include<iostream>
#include<cmath>
using namespace std;
double ju(int n){
 double sum=0;
 for(int i=1;i<=n;i++){
  sum+=log10(i);
 }
 return sum;
}
int main()
{
 int T,n;
 cin>>T;
 while(T--){
  cin>>n;
  cout<<(int)ju(n)+1<<endl;
 }
 return 0;
}

时间: 2024-08-28 19:26:52

简单数学题(水的不能在水的题了)的相关文章

hdu 2368 Alfredo&#39;s Pizza Restaurant(简单数学题)

转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2368 题目很简单,但是比较恶心,用sqrt WA到死也不过,不用秒过: 忍不住吐槽一下; Problem Description Traditionally after the Local Contest, judges and contestants go to their favourite restaurant,

hdu2374 A Game with Marbles(简单数学题)

转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2374 Problem Description There are n bowls, numbered from 1 to n. Initially, bowl i contains mi marbles. One game step consists of removing one marble from a bowl.

Codeforces Round #262 (Div. 2)460A. Vasya and Socks(简单数学题)

题目链接:http://codeforces.com/contest/460/problem/A A. Vasya and Socks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has n pairs of socks. In the morning of each day Vasya has to put o

poj 3117 World Cup(简单数学题)

题目链接:http://poj.org/problem?id=3117 World Cup Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8634   Accepted: 4327 Description A World Cup of association football is being held with teams from around the world. The standing is based on

iPhone5S钓鱼进水了游泳泡水掉水里了怎么办在质保期内(苹果推荐维修)

北京飞维智能科技有限公司是一家专业从事Ipad.Macbook.Macbook-Pro. Macbook-Air. Ibook. powerbook. G4 .G5.Mac-Mini iMAC 一体机. EMAC Ipod Touch播放器 Iphone手机 等专业综合服务公司.公司凭借着一流的维修技术,领先的IT外包服务专业的维修经验和良好的客户口碑,现已成为北京中关村及周边城市知名笔记本电脑维护.IT服务.苹果维修等服务商之一,成为广大笔记本用户和众多苹果用户密切的合作伙伴.为他们提供了强有

UVA 12714 Two Points Revisited(简单数学题)

转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4452 题意: 给出两个点组成一条直线,要你任意输出两个点,要求这两点组成的直线和给出的直线垂直(注意输出的点不能有负数): 代码如下: #include <cstdio> int main(

JZOJ5773 简单数学题

escription 话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下: 对于一个正整数N,存在一个正整数T(0<T<N),使得的值是正整数. 小X给出N,让小Y给出所有可能的T.如果小Y不回答这个神奇的大佬的简单数学题,他学神的形象就会支离破碎.所以小Y求你帮他回答小X的问题. Input  一个整数N. Output 第一个数M,表示对于正整数N,存在M个不同的正整数T,使得是整数. 后面是M个数,每一个数代表可能的正整数T(按从小到大的顺

HDU 6467 简单数学题 【递推公式 &amp;&amp; O(1)优化乘法】(广东工业大学第十四届程序设计竞赛)

传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6467 简单数学题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 308    Accepted Submission(s): 150 Problem Description 已知 F(n)=∑i=1n(i×∑j=inCij) 求 F(n) m

Sdut 2108 Alice and Bob(数学题)(山东省ACM第四届省赛D题)

题目地址:sdut 2608 Alice and Bob Alice and Bob Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*....