zoj 1526 Big Number 数学
Big Number
Time Limit:
10 Seconds Memory Limit:
32768 KB
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
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 <= 10^7 on each line.
Output
The output contains the number of digits in the factorial of the integers appearing in the input.
Sample Input
2
10
20
Sample Output
7
19
看了大师的代码,才知道居然有这种操作,orz,恕我太渣。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int t,n,i;
t=_S();
while(t--){
n=_S();
double sum = 0;
for( i = 2 ; i <= n ; i++ )
sum += log10(i);
printf("%d\n",(int)sum+1);
}
return 0;
}
出处:http://blog.csdn.net/hdweilao/article/details/48661087
zoj 1526 Big Number 数学的更多相关文章
- ZOJ 3702 Gibonacci number(数学推导)
公式推导题,G(0) = 1,G(1) = t,给出一个 i 和 G(i),要求求出G(j)的值: G(0) = 0*t + 1 G(1) = 1*t + 0; 观察t的系数和常数值可以知道二者都遵循 ...
- ZOJ 3622 Magic Number 打表找规律
A - Magic Number Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Subm ...
- ZOJ 3436 July Number(DFS)
题意 把一个数替换为这个数相邻数字差组成的数 知道这个数仅仅剩一位数 若最后的一位数是7 则称原来的数为 July Number 给你一个区间 求这个区间中July Number的个数 ...
- ZOJ 3233 Lucky Number
Lucky Number Time Limit: 5000ms Memory Limit: 32768KB This problem will be judged on ZJU. Original I ...
- HDU 1018 Big Number 数学题解
Problem Description In many applications very large integers numbers are required. Some of these app ...
- zoj.3868.GCD Expectation(数学推导>>容斥原理)
GCD Expectation Time Limit: 4 Seconds Memory Limit: 262144 KB ...
- ZOJ 3903 Ant(数学,推公示+乘法逆元)
Ant Time Limit: 1 Second Memory Limit: 32768 KB There is an ant named Alice. Alice likes going ...
- [ZOJ 3622] Magic Number
Magic Number Time Limit: 2 Seconds Memory Limit: 32768 KB A positive number y is called magic n ...
- HDU 5062 Beautiful Palindrome Number(数学)
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5062 Problem Description A positive integer x can re ...
随机推荐
- Tomcat利用Redis存储Session
详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt269 如果英文不错的看,建议直接看官网吧,官网写的挺清楚.下面的内容是转载的 ...
- Java缓存类的实际应用场景
不要着迷于技术,应把注意力放到问题上. 一个普通的后台管理系统,一定会有参数配置.参数配置数据表和其他的数据表是不同的,它的操作基本都是查的操作.参数配置的这些数据信息是贯穿在整个项目中,那么把他们放 ...
- 花生壳DDNS为何不支持LetsEncrypt申请
Inspired by Let's Encrypt Community , thx to sahsanu, jsha, and orzorc. 开端 Lets Encrypt 是一款免费的网站 SSL ...
- 【小白成长撸】--顺序栈(C语言版)
// 顺序栈.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h"//test1.0--栈表仅限Int类型 #include <stdio. ...
- MySQL插入10万数据时间(结论:最快14.967s,每秒插入6681条)
记录我的一次MySQL操作Demo: 存储过程: DROP PROCEDURE IF EXISTS my_insert; CREATE PROCEDURE my_insert() BEGIN ; lo ...
- SQL Server 2008 开启数据库的远程连接
转载: 陈萌_1016----有道云笔记 SQL Server 2008默认是不允许远程连接的,如果想要在本地用SSMS连接远程服务器上的SQL Server 2008,远程连接数据库.需要做两个部 ...
- ★10 个实用技巧,让Finder带你飞~
10 个实用技巧,让 Finder 带你飞 Finder 是 Mac 电脑的系统程序,有的功能类似 Windows 的资源管理器.它是我们打开 Mac 首先见到的「笑脸」,有了它,我们可以组织和使用 ...
- FileInputStream 小Demo
要求:设计如下界面 文本框里面可以输入的路径和文件名 单机按钮可以读取在 指定的文件 并把文件内容显示到一个文本域里面来 代码: /** * */ package com.niit.homewo ...
- 201521123062《Java程序设计》第6周学习总结
1. 本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图,对面向对象思想进行一个总结. 2. 书面作业 Q1.clone方法 1.1 Object ...
- 201521123106《java程序设计》第三周学习总结
1. 本周学习总结 2. 书面作业 代码阅读 public class Test1 { private int i = 1;//这行不能修改 private static int j = 2; pub ...