Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:请问求1000的阶乘该怎么做啊?怎么处理数据溢出?(用C++)

Posted by lanxisha at 2005-08-21 11:11:25
In Reply To:请问求1000的阶乘该怎么做啊?怎么处理数据溢出?(用C++) Posted by:lanxisha at 2005-08-21 10:42:44
题目是这样的:
阶乘结果末尾有多少零?

Time Limit:1000MS  Memory Limit:65536K
Total Submit:32 Accepted:14 

Description 

1000的阶乘1*2*3*...*1000结果是一个很大的数,求这么大的数末尾有多少个连续的零。 
Input 
本题有多组测试数据,每组测试数据占一行。 

每组数据含有一个正整数N。(N不大于1000000) 
Output 

输出一个整数,表示N!的末尾有多少个连续的零。 
Sample Input 
1
5
1000
Sample Output 
0
1
249


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator