题目链接

  看了题解之后突然发现这题简直是水题。然而不看题解就想不出来。为什么呢?

  len(x)=log10(x)+1

  于是二分寻找x。

  

#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
long long ans;
int main(){
long long l=,r=;
int n;
cin>>n;
while(l<=r){
long long mid=(l+r)>>;
long long len=mid*log10(1.0*mid)+;
if(len<n) l=mid+;
else {
ans=mid;
r=mid-;
}
}
printf("%lld",ans);
return ;
}

【Luogu】P2759奇怪的函数(二分)的更多相关文章

  1. luogu P2759 奇怪的函数 |二分答案

    题目描述 使得 x^x达到或超过 n 位数字的最小正整数 x 是多少? 输入格式 一个正整数 n 输出格式 使得 x^x达到 n 位数字的最小正整数 x 计算一个数有多少位 log10(x)+1 #i ...

  2. [LUOGU] P2759 奇怪的函数

    题目描述 使得 x^x x x 达到或超过 n 位数字的最小正整数 x 是多少? 输入输出格式 输入格式: 一个正整数 n 输出格式: 使得 x^xx x 达到 n 位数字的最小正整数 x 输入输出样 ...

  3. 洛谷P2759 奇怪的函数

    P2759 奇怪的函数 题目描述 使得 x^x 达到或超过 n 位数字的最小正整数 x 是多少? 输入输出格式 输入格式: 一个正整数 n 输出格式: 使得 x^x 达到 n 位数字的最小正整数 x ...

  4. 洛谷P2759 奇怪的函数(log 二分)

    题目描述 使得 x^xxx 达到或超过 n 位数字的最小正整数 x 是多少? 输入输出格式 输入格式: 一个正整数 n 输出格式: 使得 x^xxx 达到 n 位数字的最小正整数 x 输入输出样例 输 ...

  5. 洛谷 P2759 奇怪的函数

    https://www.luogu.org/problemnew/show/P2759 #include<cstdio> #include<algorithm> #includ ...

  6. P2759 奇怪的函数

    题目描述 使得 x^x 达到或超过 n 位数字的最小正整数 x 是多少? 输入输出格式 输入格式: 一个正整数 n 输出格式: 使得 x^x 达到 n 位数字的最小正整数 x 输入输出样例 输入样例# ...

  7. 奇怪的函数 (codevs 3538/1696) 题解

    [题目描述] 给定n,使得x^x达到或超过n位数字的最小正整数x是多少? [样例输入] 11 [样例输出] 10 [解题思路] 首先想到枚举,但是范围有点大,n<=2*10^9,果断用二分.其实 ...

  8. 【Luogu2759】奇怪的函数(数论)

    [Luogu2759]奇怪的函数(数论) 题面 题目描述 使得 \(x^{x}\)达到或超过 n 位数字的最小正整数 x 是多少? 输入输出格式 输入格式: 一个正整数 n 输出格式: 使得 \(x^ ...

  9. test20181219 奇怪的函数

    题意 奇怪的函数 [问题描述] 使得x^x达到或超过n位数字的最小正整数x是多少? [文件输入] 输入一个正整数n(n<=2*10^9). [文件输出] 输出使得x^x达到n位数字的最小正整数x ...

随机推荐

  1. iOS之核心动画

    .将动画的所有方法封装到一个类里面 MyCAHelper.h #import <Foundation/Foundation.h> #import <QuartzCore/Quartz ...

  2. RStudio的Markdown

    Title This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages ...

  3. nagios的安装配置

    主要参考博客:http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html 实验环境:centos6.4     最小化安装系统 **** ...

  4. windows下Mongodb和Memcached安装笔记

    MongoDB安装: D:\ProgramFiles\MongoDBServer3.2\bin\mongod --dbpath D:\mongoData D:\ProgramFiles\MongoDB ...

  5. 洛谷 P2353 背单词

    题目背景 小明对英语一窍不通,令老师十分头疼.于是期末考试前夕,小明被逼着开始背单词…… 题目描述 老师给了小明一篇长度为N的英语文章,然后让小明背M个单词.为了确保小明不会在背单词时睡着,老师会向他 ...

  6. cocoapods学习

    1.安装 http://stackoverflow.com/questions/16459028/rvm-install-error-running-requirements-osx-port-ins ...

  7. 找出指定文件夹中的所有以txt结尾的文件,包括所有嵌套的子文件夹

    # coding:utf-8 import os, re for i in os.walk('d:'+os.sep):     for txt in i[2]:         try:        ...

  8. mysql启动提示mysql.host 不存在,启动失败的解决方法

    图示: 日志: 190625 10:48:42 InnoDB: Started; log sequence number 0 130207190625 10:48:42 [ERROR] Fatal e ...

  9. CentOS 7 编译 mysql 8.0.12

    步骤一:安装mysql依赖 yum install -y libaio numactl 步骤二:下载mysql社区版 wget https://dev.mysql.com/get/Downloads/ ...

  10. shell 管道导致的变量重置问题

    测试脚本: #!/bin/sh flag= func() { flag= } main() { func | echo "flag=$flag" } 输出显示的flag=0! 参考 ...