lightoj1138
二分
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cassert>
#include<iomanip>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f; ll getzero(ll k)
{
ll ans=;
while(k){
ans+=k/;
k/=;
}
return ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie();
ll t,cnt=;
cin>>t;
while(t--){
ll n;
cin>>n;
ll l=,r=;
while(l<=r){
ll m=(l+r)/;
if(getzero(m)<n)l=m+;
else r=m-;
}
if(getzero(l)==n)cout<<"Case "<<++cnt<<": "<<l<<endl;
else cout<<"Case "<<++cnt<<": impossible"<<endl;
}
return ;
}
/*********************
100000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
*********************/
lightoj1138的更多相关文章
- LightOJ1138 —— 阶乘末尾0、质因子分解
题目链接:https://vjudge.net/problem/LightOJ-1138 1138 - Trailing Zeroes (III) PDF (English) Statistic ...
- LightOJ-1138 Trailing Zeroes (III) 唯一分解定理 算n!的某个因数个数
题目链接:https://cn.vjudge.net/problem/ 题意 找一个最小的正整数n 使得n!有a个零 思路 就是有几个因数10呗 考虑到10==2*5,也就是说找n!因数5有几个 数据 ...
随机推荐
- 命令行操作flask
Flask-Script 先安装pip3 install Flask-Script from sansa import create_app from flask_script import Mana ...
- centos7 docker镜像加速器配置
CentOS的配置方式略微复杂,需要先将默认的配置文件复制出来 /lib/systemd/system/docker.service -> /etc/systemd/system/docker. ...
- A4纸网页打印中对应像素的设定和换算
最近开发项目时遇到了网页打印的问题,这是问题之二,打印宽度设置 在公制长度单位与屏幕分辨率进行换算时,必须用到一个DPI(Dot PerInch)指标. 经过我仔细的测试,发现了网页打印中,默认采用 ...
- Notice公告
把网页放大到125%食用效果更佳 考试题目的密码是ftp的密码 博猪很菜,菜得抠脚,如果写的有什么问题可以在评论区指出:-) 博猪qq:1755833514
- static关键字注意事项
/* static关键字注意事项 A:在静态方法中是没有this关键字的 如何理解呢? 静态是随着类的加载而加载,this是随着对象的创建而存在. 静态比对象先存在. B:静态方法只能访问静态的成员变 ...
- HDU1069:Monkey and Banana(最长上升子序列的应用)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1069 这题挺简单的,给定一个箱子的长宽高,要求啰箱子,但必须保证下面箱子的长和宽必须大于上面的箱子. 一个 ...
- DP专题·四(树形dp)
1.poj 115 TELE 题意:一个树型网络上有n个结点,1~n-m为信号传送器,n-m+1~n为观众,当信号传送给观众后,观众会付费观看,每铺设一条道路需要一定费用.现在求以1为根,使得收到观众 ...
- HDOJ_1087_Super Jumping! Jumping! Jumping! 【DP】
HDOJ_1087_Super Jumping! Jumping! Jumping! [DP] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- ES6 Promise 让异步函数顺序执行
应用 ES6 的 内置对象 Promise, 让异步函数 按顺序执行的例子 如下: 上边 是四个用Promise 处理过的 异步执行的函数: fn1.fn2.fn3.fn4 下面,让其按顺序执行 如下 ...
- Web开发相关笔记
1.MySQL命令行下执行.sql脚本详解http://database.51cto.com/art/201107/277687.htm 在可视化工具里导出.sql脚本 --> 放命令行里运行 ...