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}\)
Explanation
factorial of (2) is 2*1=2 ,So 5^2=25 the last digit in 25 is 5
Code Editor
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
2 votes
Tags:
Very-Easy
Points:10
3 votes
Tags:
Very-Easy
Points:10
14 votes
Tags:
AlgorithmsBasics of String ManipulationMath BasicModulus ArithmeticMathNumber Theory
Editorial
Login to unlock the editorial
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
Results
Custom Input
Run your code to see the output