You are on page 1of 2

25/01/2023, 18:46 Number of groups | IEEE-SBM WIE Codathon Question | Contests | HackerRank

NEW 2
PREPARE CERTIFY COMPETE  Search   terra_earth1ing 

All Contests  IEEE-SBM WIE Codathon  Number of groups

Number of groups

Problem Submissions Leaderboard Discussions

  
Given 3 integers a,b and c where a,b,c are all positive (>0), find the number of groupings (a,b) such that
Contest ends in 2 hours
(a * lcm (x,y)) - (b * hcf(x,y)) = c
Submissions: 3
Max Score: 400
where lcm(x,y) is the least common multiple of x and y and hcf(x,y) is the highest common factor of x and y.
Difficulty: Hard
Input Format Rate This Challenge:

First line has one integer t indicating the number of testcases (1≤t≤104).

More
Next t lines contain 3 integers each - a,b,c (1≤a,b and c≤107)

Constraints

Integer t, 1≤t≤104

Integer a, 1≤a≤107

Integer b, 1≤b107

Integer c, 1≤c107

Output Format

Print the number of groupings (x,y) which satisfy the given equation for each of the test cases.

Sample Input 0

2
5 58 9
3 63 5

Sample Output 0

0
0

Sample Input 1

4
1 1 3
4 2 6
3 3 7
2 7 25

Sample Output 1

4
3
0
8

C   ⚙
https://www.hackerrank.com/contests/ieee-sbm-wie-codathon-23/challenges/number-of-groups-1-1 1/2
25/01/2023, 18:46 Number of groups | IEEE-SBM WIE Codathon Question | Contests | HackerRank

1 ▾#include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stdlib.h>
5
6 ▾int main() {
7
8 ▾    /* Enter your code here. Read input from STDIN. Print output to STDOUT */    
9    return 0;
10 }
11

Line: 1 Col: 1

 Upload Code as File Test against custom input Run Code Submit Code

Interview Prep | Blog | Scoring | Environment | FAQ | About Us | Support | Careers | Terms Of Service | Privacy Policy |

https://www.hackerrank.com/contests/ieee-sbm-wie-codathon-23/challenges/number-of-groups-1-1 2/2

You might also like