HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


153. 50368 - Right-most non zero digit in N!

Guest
• Discussion of problem (2)

Volume problems

• 136. 50443 - Dajte Express
• 140. 50655 - Divisibility by 9
• 145. 50656 - Divisibility by 11
• 147. 50553 - Divisible by m
• 148. 50596 - Your Ride Is Here (US...
• 148. 50596 - Your Ride Is Here (US...
• 150. 50763 - Valid Password
• 151. 50560 - Max Distance
• 153. 50368 - Right-most non ze...
• 155. 50379 - a^b modulus k
• 158. 50404 - Sum of Self Powers
• 160. 50546 - Average Fuel Price
• 180. 50343 - The number of Ending...
• 30. 50764 - Fast Typing Competition

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