CF Manthan, Codefest 16 B. A Trivial Problem
数学技巧真有趣,看出规律就很简单了 wa
题意:给出数k 输出所有阶乘尾数有k个0的数
这题来来回回看了两三遍, 想的方法总觉得会T
后来想想 阶乘 emmm 1*2*3*4*5*6*7*8*9*10...*n 尾数的0只与5有关
是5的几倍就有几个0 因为5前面肯定有偶数 乘起来就有一个0 而且最后输出肯定是连续的5个
hhh 兴奋 开始上手 乱搞一下 发现复杂度还行
测样例 发现 k=5 的时候不对了 输出25~29了 应该是0的
咦 测了一下 25!应该是6个0的 25=5*5 有两个5 wa
每次循环找的时候都判断是否是5的倍数,是则不断除5,计数累加; 否则继续下一循环
hhh 又乱搞了一下 A了
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
typedef long double ld;
#define mem(x) memset(x, 0, sizeof(x))
#define me(x) memset(x, -1, sizeof(x))
#define fo(i,n) for(i=0; i<n; i++)
#define sc(x) scanf("%lf", &x)
#define pr(x) printf("%lld\n", x)
#define pri(x) printf("%lld ", x)
#define lowbit(x) x&-x
const ll MOD = 1e18 +;
const ll N = 6e6 +;
int main()
{
ll i, j, k, l=;
ll n, m, t=;
cin>>k;
ll co=;
while()
{
if(co>=k) break;
t+=; //不断+5 统计5的个数
m=t;
while(m%==) //统计该数有几个5
{
m/=;
co++;
}
}
if(co>k)
{
cout<<<<endl;
return ;
}
cout<<<<endl;
for(i=t;i<=t+; i++)
{
cout<<i<<' ';
}cout<<endl;
return ;
}
CF Manthan, Codefest 16 B. A Trivial Problem的更多相关文章
- Manthan, Codefest 16 B. A Trivial Problem 二分 数学
B. A Trivial Problem 题目连接: http://www.codeforces.com/contest/633/problem/B Description Mr. Santa ask ...
- CF Manthan, Codefest 16 G. Yash And Trees 线段树+bitset
题目链接:http://codeforces.com/problemset/problem/633/G 大意是一棵树两种操作,第一种是某一节点子树所有值+v,第二种问子树中节点模m出现了多少种m以内的 ...
- CF #Manthan, Codefest 16 C. Spy Syndrome 2 Trie
题目链接:http://codeforces.com/problemset/problem/633/C 大意就是给个字典和一个字符串,求一个用字典中的单词恰好构成字符串的匹配. 比赛的时候是用AC自动 ...
- Manthan, Codefest 16(B--A Trivial Problem)
B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Manthan, Codefest 16
暴力 A - Ebony and Ivory import java.util.*; import java.io.*; public class Main { public static void ...
- Manthan, Codefest 16 B 数学
B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Manthan, Codefest 16 H. Fibonacci-ish II 大力出奇迹 莫队 线段树 矩阵
H. Fibonacci-ish II 题目连接: http://codeforces.com/contest/633/problem/H Description Yash is finally ti ...
- Manthan, Codefest 16 E. Startup Funding ST表 二分 数学
E. Startup Funding 题目连接: http://codeforces.com/contest/633/problem/E Description An e-commerce start ...
- Manthan, Codefest 16 G. Yash And Trees dfs序+线段树+bitset
G. Yash And Trees 题目连接: http://www.codeforces.com/contest/633/problem/G Description Yash loves playi ...
随机推荐
- rpm 包的安装:
参考博客: https://www.cnblogs.com/lzj87980239/p/3611776.html 如果已经安装了一个 rpm 包, 然后这个安装包又重新打了, 但是安装包的名字没有修改 ...
- 手动创建Oracle实例
手工建库步骤 Step 1: Specify an Instance Identifier (SID)(指定一个实例的标识符SID)Step 2: Ensure That the Required E ...
- MySQL实用基本操作
本博客写是装好Mysql并配好环境变量后的基本操作(windows10系统下)且都是黑框内的操作. 一.登陆MySQL 首先启动服务,在桌面左下角图标处点击右键Windows PowerShell(管 ...
- [MSF]server/capture/http_javascript_keylogger键盘记录
server/capture/http_javascript_keylogger DEMO使用的官方的效果图: 使用方法: show options 看看 msf auxiliary(server/c ...
- 一个Monkey测试的小坑
环境:Genymotion模拟器+Custome Phone-6.0.0,API 23 操作步骤如下: cd data/app ls //为了获取待测apk的包名 获取结果如下: 执行命令,其中包名使 ...
- Centos6.10 安装Python 2.7.16
部署一个程序, 系统环境:CentOS 6.10 64位 Python版本:2.7 1.升级下系统 yum install eple-release -y yum update -y 2.下载pyth ...
- 常见mysql的慢查询优化方式
一,第一步.开启mysql慢查询 方式一: 修改配置文件 在 my.ini 增加几行: 主要是慢查询的定义时间(超过2秒就是慢查询),以及慢查询log日志记录( slow_query_log) 方 ...
- python3 短网址和数字的相互转换的代码
下面内容是关于python3 短网址和数字的相互转换的内容. import mathimport decimal def convert_to_code(num): """ ...
- c++的一些入门
cout:对象名 <<:是一种插入运算符 endl:换行 :列如:count <<"Hello!"<<endl; //把hello送到 ...
- 【源码】HashMap源码及线程非安全分析
最近工作不是太忙,准备再读读一些源码,想来想去,还是先从JDK的源码读起吧,毕竟很久不去读了,很多东西都生疏了.当然,还是先从炙手可热的HashMap,每次读都会有一些收获.当然,JDK8对HashM ...