Fun and fair
Practice
0 (0 votes)
Mathematics
Medium
Problem
94% Success 17 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Recently, Nick has been assigned the task of collecting money for the school fair,their are K houses in his town and they are numbered from 1 to K.
The i th house will give i^x (1<=i<=K) money,where x is a positive integer.
Nick is a greedy person and he will divide the total sum collected with 10^z (z>=0) such that GCD(10^z,sum)=10^z.Find the greatest value of z that he can achieve.
INPUT:
Each line consists of two integers K and x.Input will terminate with EOF .
OUTPUT:
Output maximum value of z for every test case.
Constraints:
test case <10
1<=K<=100
1<=x<=10^6
Submissions
Please login to view your submissions
Similar Problems
Points:30
6 votes
Tags:
AlgorithmsApprovedBinary SearchMediumOpenSorting
Points:30
9 votes
Tags:
MediumAlgorithms
Points:30
Tags:
Medium
Editorial