二分

#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的更多相关文章

  1. LightOJ1138 —— 阶乘末尾0、质因子分解

    题目链接:https://vjudge.net/problem/LightOJ-1138 1138 - Trailing Zeroes (III)    PDF (English) Statistic ...

  2. LightOJ-1138 Trailing Zeroes (III) 唯一分解定理 算n!的某个因数个数

    题目链接:https://cn.vjudge.net/problem/ 题意 找一个最小的正整数n 使得n!有a个零 思路 就是有几个因数10呗 考虑到10==2*5,也就是说找n!因数5有几个 数据 ...

随机推荐

  1. pip与apt-get

    在ubuntu服务器下安装包的时候,经常会用到sudo apt-get install 包名 或 sudo pip install 包名,那么两者有什么区别呢? 1.区别 pip用来安装来自PyPI( ...

  2. Linux系统下实时监控网口速率的shell脚本

    修改后的脚本文件 #!/bin/bash #Modified by lifei4@datangmobile.cn echo ===DTmobile NetSpeedMonitor=== sleep 1 ...

  3. HDU1506: Largest Rectangle in a Histogram(最大子矩阵,好题动态优化左右边界)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1506 刚开始没考虑时间复杂度,直接敲了,直接tle了,之后没有思路,然后看题解,看见大神写的优化非常棒. ...

  4. PAT 1081 Rational Sum[分子求和][比较]

    1081 Rational Sum (20 分) Given N rational numbers in the form numerator/denominator, you are suppose ...

  5. List和Set区别

    1. Set 接口实例存储的是无序的,不重复的数据.List 接口实例存储的是有序的,可以重复的元素. 2. Set检索效率低下,删除和插入效率高,插入和删除不会引起元素位置改变 <实现类有Ha ...

  6. windows10+mysql8.0.zip安装

    〇.准备: MySQL8.0 Windows zip包下载地址:https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip 环 ...

  7. 【leetcode刷题笔记】Convert Sorted Array to Binary Search Tree

    Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题解 ...

  8. vuex初使用

  9. 当root用户无密码,非超级权限用户时提示mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this op解决方案

    问题: 在centOS上安装了mysql后,卸载了又重新安装,使用mysqladmin -u root password 'new password' 更改密码,提示: mysqladmin: Can ...

  10. SpringBoot 定义通过字段验证

    第一步:定义ValidationResult类 public class ValidationResult { // 校验结果是否有错 private boolean hasErrors = fals ...