HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50049 - Right-most non zero digit in N!

Section problems

• 50049 - Right-most non zero di...
• 50050 - Base Conversion
• 50051 - Number Quadruplets
• 50053 - kth Permutation
• 50070 - Number of Chairs
• 50073 - Missing Number
• 50077 - Valid Permutations
• 50079 - Fun Fair
• 50089 - Sum of Cubes

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

The right-most non zero digit in N!

Question:
Write a program which shows the right-most non-zero digit in N! where N is a positive integer less than 32000. For example:

  • 5!=120 ==> right-most non zero digit is 2
  • 7!=5040 ==> right-most non zero digit is 4
  • 10!=368800 ==> right-most non zero digit is 8

Input specification
You are given an integer (N) where is 1 ≤ N ≤ 32,000.

Output specification
Show right most non-zero digit in N!

 Sample Input I     Sample Input II   
 345
 1000
 Sample Output I     Sample Output II   
 8
 2


Для отправки решений необходимо выполнить вход.

www.contester.ru