题目链接

https://www.nowcoder.com/acm/contest/93/E

思路

其实就是找阶乘的项中5的个数

末尾为什么会出现0

因为存在5的倍数和偶数相乘 有0存在

借鉴

https://blog.csdn.net/tommyzht/article/details/46309563

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> #define CLR(a) memset(a, 0, sizeof(a))
#define pb push_back using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair<string, int> psi;
typedef pair<string, string> pss; const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-30; const int INF = 0x3f3f3f3f;
const int maxn = 1e9 + 5;
const int MOD = 1e9 + 7;
//
//int num[maxn], len;
//
//void init()
//{
// len = 1;
// num[0] = 1;
//}
//
//int mult(int num[], int len, int n)
//{
// ll tmp = 0;
// for (ll i = 0; i < len; i++)
// {
// tmp = tmp + num[i] * n;
// num[i] = tmp % 10;
// tmp = tmp / 10;
// }
// while (tmp)
// {
// num[len++] = tmp % 10;
// tmp = tmp / 10;
// }
// return len;
//} int main()
{
int T;
scanf("%d", &T);
while (T--)
{
//int Num;
//scanf("%d", &Num);
//init();
//for (int i = 2; i <= Num; i++)
//{
// len = mult(num, len, i);
//}
//int ans = 0;
//for (int i = 0; i < len; i++)
//{
// if (num[i])
// break;
// else
// ans++;
//}
//printf("%d\n", ans);
int n;
scanf("%d", &n);
int ans = 0;
for (int i = 5; ; i *= 5)
{
ans += n / i;
if (n / i == 0)
break;
}
printf("%d\n", ans);
}
}

2018年东北农业大学春季校赛 E wyh的阶乘 【数学】的更多相关文章

  1. 2018年东北农业大学春季校赛 K wyh的数列【数论/斐波那契数列大数取模/循环节】

    链接:https://www.nowcoder.com/acm/contest/93/K来源:牛客网 题目描述 wyh学长特别喜欢斐波那契数列,F(0)=0,F(1)=1,F(n)=F(n-1)+F( ...

  2. 2018年东北农业大学春季校赛 I wyh的物品【01分数规划/二分】

    链接:https://www.nowcoder.com/acm/contest/93/I来源:牛客网 题目描述 wyh学长现在手里有n个物品,这n个物品的重量和价值都告诉你,然后现在让你从中选取k个, ...

  3. 2018年东北农业大学春季校赛 F wyh的集合【思维】

    链接:https://www.nowcoder.com/acm/contest/93/F来源:牛客网 题目描述 你们wyh学长给你n个点,让你分成2个集合,然后让你将这n个点进行两两连接在一起,连接规 ...

  4. 2018年东北农业大学春季校赛 D wyh的迷宫【搜索】

    链接:https://www.nowcoder.com/acm/contest/93/D来源:牛客网 题目描述 给你一个n*m的迷宫,这个迷宫中有以下几个标识: s代表起点 t代表终点 x代表障碍物 ...

  5. 2018年东北农业大学春季校赛 B wyh的矩阵【找规律】

    链接:https://www.nowcoder.com/acm/contest/93/B来源:牛客网 题目描述 给你一个n*n矩阵,按照顺序填入1到n*n的数,例如n=5,该矩阵如下 1 2 3 4 ...

  6. 2018年东北农业大学春季校赛 E wyh的集合 【数学】

    题目链接 https://www.nowcoder.com/acm/contest/93/F 思路 其实容易知道在两个不同集合里 假设元素个数 分别为 a b 然后对于第一个集合里的每一个元素 都可以 ...

  7. 2018年东北农业大学春季校赛 D wyh的迷宫 【BFS】

    题目链接 https://www.nowcoder.com/acm/contest/93/D 思路 BFS模板题 AC代码 #include <cstdio> #include <c ...

  8. 2018年东北农业大学春季校赛 B wyh的矩阵【规律】

    题目链接 https://www.nowcoder.com/acm/contest/93/B 思路 先加入 中间的那行 和中间的那列 再减去 最中间那个数 因为它 加了两次 然后逐行往下加 会发现是一 ...

  9. 2018年东北农业大学春季校赛-wyh的吃鸡

    BFS: 1. 从起点开始BFS,遇到X点则return: 2. vis[px][py][0]代表经过pxpy这点前还没有找到车: vis[px][py][1]代表经过pxpy这点前已经找到车: 3. ...

随机推荐

  1. ubuntu 添加用户

    sudo useradd 用户名 创建用户 sudo passwd 用户名 修改用户密码 添加sudo权限 sudo usermod -aG sudo(要添加的用户组,也可以是root) 用户名 su ...

  2. OpenSceneGraph-3.3.3

    OpenSceneGraph-3.3.3, [/b]released on 19th December 2014, key deliverables in this dev release are: ...

  3. Centos7/RedHat7 下 python3使用cx-freeze打包matplotlib程序遇到的问题和解决办法

    折腾了一天遇到了几个头疼的问题,还好回去前解决掉了 第一个:执行cxfreeze打包好的程序遇到 tkinter 和 _tkinter的缺失问题 首先终端:python tkinter python ...

  4. maven打包时出现no compiler is provided in this environment

    我是使用maven打jar包时出现的问题,与我问题不同的可以查看下面链接是否有棒状 http://blog.csdn.net/lslk9898/article/details/73836745 可以确 ...

  5. vuex 中关于 mapState 的作用

    辅助函数 Vuex 除了提供我们 Store 对象外,还对外提供了一系列的辅助函数,方便我们在代码中使用 Vuex,提供了操作 store 的各种属性的一系列语法糖,下面我们来一起看一下: mapSt ...

  6. 应该知道的Linux技巧(转载)

    这篇文章来源于Quroa的一个问答<What are some time-saving tips that every Linux user should know?>—— Linux用户 ...

  7. UDP通信接收端,接收二维数组,内容为0与1

    1: using System; 2: using System.Net; 3: using System.Net.Sockets; 4: using System.Text; 5:   6:   7 ...

  8. 使用 mybatis + flying + 双向相关建模 的电商后端

    代码地址如下:http://www.demodashi.com/demo/12468.html mybatis.flying 众所周知,mybatis 虽然易于上手,但放到互联网环境下使用时,不可避免 ...

  9. 七款Debug工具推荐:iOS开发必备的调试利器

    历时数周或数月开发出来了应用或游戏.可为什么体验不流畅?怎么能查出当中的纰漏?这些须要调试诊断工具从旁协助.调试是开发过程中不可缺少的重要一环.本文会列举几个比較有效的调试诊断工具,能够帮助你寻根究底 ...

  10. link标签的rel属性

    <link>标签定义了当前文档与 Web 集合中其他文档的关系.link 元素是一个空元素,它仅包含属性.此元素只能存在于 head 部分,不过它可出现任何次数.在 HTML 中,< ...