Base numbers
Practice
3.7 (25 votes)
Algorithms
Binary search
Easy
Searching
Problem
62% Success 3178 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

You are given three integers \(a\), \(b\), and \(n\). Your task is to determine the number of positive integers \(x\in[1,10^9]\) such that \(ax^x\) is an n-digit number of base \(b\).

Input format

The input contains many test cases. Each test case is represented in a new line. Every line contains three integers, a, n, and b (\(1\leq a,n\leq 10^9,2\leq b\leq 10\))

Note: There are at most 1000 test cases.

Output format

For each test case, print the answer.

 

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:20
272 votes
Tags:
Binary SearchEasyOpenSorting
Points:20
12 votes
Tags:
ApprovedBinary SearchEasyGrammar-VerifiedHiringMathSearching
Points:20
38 votes
Tags:
ApprovedBinary SearchData StructuresEasyHash MapsHashing AlgorithmOpenSorting