- 浏览: 1653627 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (405)
- C/C++ (16)
- Linux (60)
- Algorithm (41)
- ACM (8)
- Ruby (39)
- Ruby on Rails (6)
- FP (2)
- Java SE (39)
- Java EE (6)
- Spring (11)
- Hibernate (1)
- Struts (1)
- Ajax (5)
- php (2)
- Data/Web Mining (20)
- Search Engine (19)
- NLP (2)
- Machine Learning (23)
- R (0)
- Database (10)
- Data Structure (6)
- Design Pattern (16)
- Hadoop (2)
- Browser (0)
- Firefox plugin/XPCOM (8)
- Eclise development (5)
- Architecture (1)
- Server (1)
- Cache (6)
- Code Generation (3)
- Open Source Tool (5)
- Develope Tools (5)
- 读书笔记 (7)
- 备忘 (4)
- 情感 (4)
- Others (20)
- python (0)
最新评论
-
532870393:
请问下,这本书是基于Hadoop1还是Hadoop2?
Hadoop in Action简单笔记(一) -
dongbiying:
不懂呀。。
十大常用数据结构 -
bing_it:
...
使用Spring MVC HandlerExceptionResolver处理异常 -
一别梦心:
按照上面的执行,文件确实是更新了,但是还是找不到kernel, ...
virtualbox 4.08安装虚机Ubuntu11.04增强功能失败解决方法 -
dsjt:
楼主spring 什么版本,我的3.1 ,xml中配置 < ...
使用Spring MVC HandlerExceptionResolver处理异常
The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest signal (in a little simplified view). Of course, BTSes need some attention and technicians need to check their function periodically.
ACM technicians faced a very interesting problem recently. Given a set of BTSes to visit, they needed to find the shortest path to visit all of the given points and return back to the central company building. Programmers have spent several months studying this problem but with no results. They were unable to find the solution fast enough. After a long time, one of the programmers found this problem in a conference article. Unfortunately, he found that the problem is so called "Travelling Salesman Problem" and it is very hard to solve. If we have N BTSes to be visited, we can visit them in any order, giving us N! possibilities to examine. The function expressing that number is called factorial and can be computed as a product 1.2.3.4....N. The number is very high even for a relatively small N.
The programmers understood they had no chance to solve the problem. But because they have already received the research grant from the government, they needed to continue with their studies and produce at least some results. So they started to study behaviour of the factorial function.
For example, they defined the function Z. For any positive integer N, Z(N) is the number of zeros at the end of the decimal form of number N!. They noticed that this function never decreases. If we have two numbers N1<N2, then Z(N1) <= Z(N2). It is because we can never "lose" any trailing zero by multiplying by any positive number. We can only get new and new zeros. The function Z is very interesting, so we need a computer program that can determine its value efficiently.
Input Specification
There is a single positive integer T on the first line of input. It stands for the number of numbers to follow. Then there is T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.
Output Specification
For every number N, output a single line containing the single non-negative integer Z(N).
Sample Input
6
3
60
100
1024
23456
8735373
Sample Output
0
14
24
253
5861
2183837
ACM technicians faced a very interesting problem recently. Given a set of BTSes to visit, they needed to find the shortest path to visit all of the given points and return back to the central company building. Programmers have spent several months studying this problem but with no results. They were unable to find the solution fast enough. After a long time, one of the programmers found this problem in a conference article. Unfortunately, he found that the problem is so called "Travelling Salesman Problem" and it is very hard to solve. If we have N BTSes to be visited, we can visit them in any order, giving us N! possibilities to examine. The function expressing that number is called factorial and can be computed as a product 1.2.3.4....N. The number is very high even for a relatively small N.
The programmers understood they had no chance to solve the problem. But because they have already received the research grant from the government, they needed to continue with their studies and produce at least some results. So they started to study behaviour of the factorial function.
For example, they defined the function Z. For any positive integer N, Z(N) is the number of zeros at the end of the decimal form of number N!. They noticed that this function never decreases. If we have two numbers N1<N2, then Z(N1) <= Z(N2). It is because we can never "lose" any trailing zero by multiplying by any positive number. We can only get new and new zeros. The function Z is very interesting, so we need a computer program that can determine its value efficiently.
Input Specification
There is a single positive integer T on the first line of input. It stands for the number of numbers to follow. Then there is T lines, each containing exactly one positive integer number N, 1 <= N <= 1000000000.
Output Specification
For every number N, output a single line containing the single non-negative integer Z(N).
Sample Input
6
3
60
100
1024
23456
8735373
Sample Output
0
14
24
253
5861
2183837
#include<iostream> using namespace std; int main() { int num,n,sum; cin>>num; while(num--) { sum=0; cin>>n; while(n/=5) { sum+=n; } cout<<sum<<endl; } return 0; }
发表评论
-
二分查找之变型题目
2010-10-24 12:40 2158二分查找算法在各个公司的笔试面试题大量出现,通常不是简单一眼就 ... -
一道笔试题(创新工厂)解法
2010-10-21 17:44 1855一个帖子http://www.iteye.com/topic/ ... -
[zz]大数据量,海量数据 处理方法总结
2010-08-27 22:24 2273大数据量的问题是很多面试笔试中经常出现的问题,比如baidu ... -
Trie and suffix array
2010-04-13 20:54 1927字典数Trie和后缀数组suffix array是处理字符串操 ... -
金币问题
2009-11-09 08:41 2018今年某公司的笔试题: 一个矩阵地图,每一个元素值代表金币数, ... -
楼梯问题
2009-11-09 08:19 1577hl给我的几道某公司的算法题: 1、 有个 100 级的 ... -
一道考察模拟乘法的题目
2009-11-07 22:37 1422今天hl和我讨论一道题目: 写道 整形数组如a={1,4, ... -
链表归并
2009-11-07 21:40 1038以前gx同学问的某某公司的笔试题,写一下练练(纯手写,没编译过 ... -
找出出现次数超过一半的数字
2009-11-07 21:23 1891hl同学问我一道这个题,想了一种方法,感觉还是不错的,只扫描一 ... -
有道难题以超低分晋级
2009-06-10 11:36 1568有道难题比赛居然晋级了,可以领到一个t-shirt。 -
逆序数/逆序数对
2009-06-09 23:17 3785逆序数是个常遇到的问题,主要有两种解法: O(n^2)的方法: ... -
有道难题topcoder
2009-05-31 23:55 2461今天做了有道topcoder的题目,也是第一次在topcode ... -
百度之星第一场题目
2009-05-31 00:03 3654由于不符合参赛条件,未能参加百度之星,看了题目还挺有意思,把题 ... -
一个对字符串很好的Hash函数ELFHHash
2009-05-03 21:41 2282#include<stdio.h> #defin ... -
最大流Ford-Fulkerson算法
2009-04-22 17:33 9685算法导论对最大流算法有很详细的介绍,今天实现了最大流Ford- ... -
大数/高精度加减乘除取模[收藏]
2009-04-16 19:38 5068#include <iostream> #i ... -
带重复数字的全排列
2009-04-16 18:58 3894上次gx同学问我一道又重复数字的全排列的问题,我当时用set保 ... -
差分约束系统
2009-04-15 16:00 3747(本文假设读者已经有以下知识:最短路径的基本性质、Bellma ... -
二分图匹配
2009-04-15 15:40 3730二分图最大匹配的匈牙利算法 二分图是这样一个图,它的顶点可以分 ... -
线段树
2009-03-24 10:58 1688把问题简化一下: 在自然数,且所有的数不大于30000的 ...
相关推荐
【标题】"joj acm 部分习题解答"揭示了这是一份与JOJ(Judge Online Job)和ACM(国际大学生程序设计竞赛)相关的资源,主要是作者对于某些题目的解题思路和代码实现。JOJ是用于在线评测编程竞赛题目的一种平台,而...
描述中提到的"joj acm 源代码",JOJ(Judge Online Judge)是一个在线编程评测系统,很多高校和编程爱好者使用它来提交和测试代码,解决各种算法问题。源代码通常是程序员编写的原始程序,这里指的可能是参赛者在ACM...
【标题】:“JOJ上做的一些ACM试题” 在计算机科学领域,ACM(Association for Computing Machinery)国际大学生程序设计竞赛是一项备受瞩目的比赛,旨在提升大学生的算法设计、问题解决以及团队协作能力。JOJ...
【标题】"JOJ-jilin-university--acm.rar_joj" 提供的是吉林大学JOJ在线判题系统的编程竞赛代码集,主要用于帮助初学者入门。 【描述】中的信息表明,这个压缩包内的代码样例是专门为在JOJ平台上进行编程训练的学生...
#### 标题:吉林大学ACM题集.pdf—JOJ 此文档标题明确指出了文档的主要内容——一个由吉林大学组织编写的ACM竞赛题集,并且该题集是以PDF格式提供的。这里提到的“JOJ”即吉林大学在线裁判系统(Jilin University On...
joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考
根据给定的信息,本文将详细解释“acm joj 1600”中的两种大数取模运算方法。此问题主要关注如何高效地计算形如 \(a^b \mod m\) 的表达式,这对于处理大数据或进行密码学运算非常重要。 ### 大数取模运算 #### ...
操作系统中的页面置换算法是内存管理的重要组成部分,尤其是在虚拟内存系统中。先进先出(First In First Out,简称FIFO)页面置换算法是一种简单的页面置换策略,它的基本思想是:当需要淘汰一个页面时,选择最早...
吉林大学 joj 1000-2645题代码,嘿嘿,大家就不用在花JPOINT买代码了,祝ACMer实现自己的心愿
Java 开源项目 Joj 是一个致力于为 Java 源代码提供对象化表示的库,它类似于 JDOM 在处理 XML 文档中的角色。Joj 的设计目标是为开发者提供一种更直观、更方便的方式来操作和解析 Java 代码,使得在处理大量 Java ...
Etre au courant quand JoJ est en live,策划人semaine et liens vers lesréséauxauxsocioaux Soyez au courant纠结JoJ开始à流光! 现场直播将继续进行。 约翰·奎因·伊斯特·布鲁和克林·德集团的非官方网站 D...
标题“joj 1424 硬币兑换问题”描述的是一个经典的计算机编程问题,它涉及到使用动态规划(Dynamic Programming, DP)方法来解决硬币找零问题。在这个问题中,我们要找到使用最少数量的硬币来凑成特定金额的方式。...
这个题其实现在想起来也不知道是怎么就给ac的。
该mod基于荒木飞吕彦的JoJo的奇妙冒险漫画和动漫系列。 这个mod也受到KnightDemon的1.12 mod 极大启发。 这个mod的目的是要从专营权中尽可能多地增加Minecraft,该mod目前仅包含Stand能力,其他能力(Hamon,...
4. **现场管理目标**:根据JOJ59—59安全检查标准和重庆市建筑工地文明施工标准,对施工现场进行规范化管理,争取成为重庆市的安全文明施工示范工地。 5. **安全管理目标**: - **安全教育目标**:建立安全生产...
furystudios 普尔维·扎达塔克(Prvi zadatak) ...DroppingOff - radnikhodajućidolazi做pripadajuće科萨雷(izvedeno kroz provjeru tagova kutije)我卡达joj JE dovoljno blizu,fizičkiJE lan
Este Projeto签证是由estoque进行的,它是由mer mercadorias uma determinada empresa sejam averiguadas和atualizadas ... 2021年1月20日,由JoséCláudiodeAraújoJúnior和Annielly Ferreira de Sousa所设计。
大智慧最新安装包,老的已经过期不能查询个人自选股,所以推荐最新的大智慧给大家安装