Factorial equations
Practice
3.4 (57 votes)
Mathematics
Modulus arithmetic
Math
Number theory
Problem
92% Success 26188 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given two numbers \(X\) and \(N\). Your task is to find the last digit of the following equation: 
\(X^{((N!)\div mod\ 10)}\)

Input format

The first line contains two integers \(X\) and \(N\).

Output format

Print the last digit of the given equation.

Constraints

\(1 \leq X \leq 10^9\\ 0 \leq N \leq 10^{18}\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
3 votes
Tags:
Very-Easy
Points:10
14 votes
Tags:
AlgorithmsBasics of String ManipulationMath BasicModulus ArithmeticMathNumber Theory
Points:10
2 votes
Tags:
Very-Easy