sdnu1250递归

1250.F.陆历川让你A个题
Description

This a veryyyyyyyyyyyyyy hard problem.One day, Lulichuan was played in city X with his friend, they like to paly a game called hide and seek,they was playing hide-and-seek, and suddenly a gust of wind blew up. The wind rolled up all the dust, so they went into a house to take refuge and stayed in the house so boring that they turned around. At the time, a small partner discovered a strange house. His surroundings were gleaming. At this time they cautiously walked into this shimmering room. They found an ancient cheat in the room. With ancient books, if anyone can solve for the number of zeros at the end of a number’ factorial .who will get a mysterious treasure, they soon find out the answer, but they are afraid of making mistakes, so they hope you can count them again. In order to help them test the answer.

Input

The first line T(0 < T< 1000)Follow T line every line a N(0 < N < 1000000)

Output

Answer

Sample Input

2
5
6

Sample Output

1
1

找n中有多少个5相乘 递归水题

#include<bits/stdc++.h>
using namespace std;
int digui(int n)
{
   
    if(n==0||n==1)
        return 0;
    else
        return n/5+digui(n/5);
}
int main()
{
   
    int n,t,m;
    scanf("%d",&t);
    while(t--)
    {
   
        scanf("%d",&n);
        int ans;
        ans=digui(n);
        cout<<ans<<'\n';
    }
    return 0;
}

全部评论

相关推荐

11-29 11:21
门头沟学院 Java
点赞 评论 收藏
分享
耀孝女:就是你排序挂了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
正在热议
# 25届秋招总结 #
443331次浏览 4520人参与
# 春招别灰心,我们一人来一句鼓励 #
42187次浏览 537人参与
# 阿里云管培生offer #
120415次浏览 2220人参与
# 地方国企笔面经互助 #
7973次浏览 18人参与
# 同bg的你秋招战况如何? #
77166次浏览 569人参与
# 实习必须要去大厂吗? #
55811次浏览 961人参与
# 北方华创开奖 #
107468次浏览 600人参与
# 虾皮求职进展汇总 #
116163次浏览 886人参与
# 如果你有一天可以担任公司的CEO,你会做哪三件事? #
11683次浏览 289人参与
# 实习,投递多份简历没人回复怎么办 #
2454962次浏览 34861人参与
# 提前批简历挂麻了怎么办 #
149927次浏览 1978人参与
# 在找工作求抱抱 #
906096次浏览 9421人参与
# 如果公司给你放一天假,你会怎么度过? #
4762次浏览 55人参与
# 你投递的公司有几家约面了? #
33209次浏览 188人参与
# 投递实习岗位前的准备 #
1196037次浏览 18550人参与
# 机械人春招想让哪家公司来捞你? #
157648次浏览 2267人参与
# 双非本科求职如何逆袭 #
662384次浏览 7397人参与
# 发工资后,你做的第一件事是什么 #
12798次浏览 62人参与
# 工作中,努力重要还是选择重要? #
35906次浏览 384人参与
# 简历中的项目经历要怎么写? #
86937次浏览 1516人参与
# 参加完秋招的机械人,还参加春招吗? #
20153次浏览 240人参与
# 我的上岸简历长这样 #
452074次浏览 8089人参与
牛客网
牛客企业服务