Walter, Jesse and HCF
Practice
3.9 (132 votes)
Number theory
Easy
Mathematics
Open
Approved
Factorization
Problem
85% Success 5972 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Walter and Jesse's friend Mike had helped them in making Crymeth and hence, they wanted to give him a share.
For deciding the share, they both decided to choose one number each, X and Y and found out that Kth Highest Common Factor of their two numbers is a good amount of Crymeth that can be given to Mike .
Walter and Jesse did this activity for D days in total. For each day, find out what quantity of Crymeth they decided to give to Mike.

Input:

First line contains a natural number D - the total number of days.
D lines follow. Each line contains three natural numbers - X, Y and K.

Output:

For each day, print the quantity given to Mike on a new line.
If the Kth HCF of X and Y does not exist, simply print "No crymeth today" (Without the quotes)

Constraints:

  • 1D103
  • 1X, Y, K1010

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
154 votes
Tags:
Number TheoryEasyReadyMathematicsOpenApprovedFactorization
Points:20
20 votes
Tags:
Binary search algorithmNumber TheoryAlgorithmsEasyMathematicsOpenApproved
Points:20
13 votes
Tags:
Prime FactorizationEasyMathematicsFactorization